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.AdminTranslations = new Roo.XComponent({
10 '0a52da7a03a6de3beefe54f8c03ad80d' :"Original",
11 '69fd71b6f79260924a32a45850a13ab7' :"Translations (rescan this to update strings)",
12 '9d1ead73e678fa2f51a70a933b0bf017' :"Not Found",
13 '801ab24683a4a8c433c6eb40c48bcd9d' :"Download",
14 '6dd08874f83507e9c7b23f1a46b7fa7c' :"Translation",
15 '07a1d316d1065473f290c3c2b72a80f3' :"Application Words",
16 'e3d388b2c43e5ba0905702620ae2abc1' :"Search for",
17 'e2f9d206562d8f5ea421ad51100f7151' :"Displaying petition_entry{0} - {1} of {2}",
18 'cd6ae20e52d83f601c5fa12b66f0f6d0' :"Rescan",
19 '91412465ea9169dfd901dd5e7c96dd99' :"Upload",
20 '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
21 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
22 '03c2e7e41ffc181a4e84080b4710e81e' :"New",
23 '193cfc9be3b995831c6af2fea6650e60' :"Page",
24 '1bc29b36f623ba82aaf6724fd3b16718' :"md5"
27 part : ["Admin", "Translations" ],
28 order : '950-Pman.Tab.AdminTranslations',
30 parent : 'Pman.Tab.AdminTranslationsInt',
31 name : "Admin - Translations",
33 permname : 'Admin.Translations',
34 _tree : function(_data)
39 xtype : 'NestedLayoutPanel',
41 title : _this._strings['07a1d316d1065473f290c3c2b72a80f3'] /* Application Words */,
45 xtype : 'BorderLayout',
49 xtype : 'LayoutRegion',
54 xtype : 'LayoutRegion',
65 render : function (_self)
67 _this.treepanel = _self;
79 text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
81 click : function (_self, e)
83 Pman.Dialog.AdminLanguagePick.show( { }, function(lang) {
86 url : baseURL + '/Roo/core_templatestr',
93 _this.treepanel.tree.getRootNode().reload();
102 '|xns' : 'Roo.Toolbar'
107 '|xns' : 'Roo.Toolbar'
111 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
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");
137 '|xns' : 'Roo.Toolbar'
142 '|xns' : 'Roo.Toolbar'
146 text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
148 click : function (_self, e)
150 var tree = _this.treepanel.tree;
152 var sn = tree.getSelectionModel().getSelectedNode();
155 Roo.MessageBox.alert("Error", "Select a node");
169 var syncTemplate = function(){
171 var step = steps.shift();
172 Roo.MessageBox.updateProgress( (5.0 - steps.length) / 5.0, "Running " + step);
175 url : baseURL + '/Admin/UpdateBjsTemplates/' + step,
177 //mask : 'Processing...',
181 if (steps.length > 0 ) {
185 Roo.MessageBox.hide();
186 _this.treepanel.tree.getRootNode().reload();
193 var syncLanguage = function(){
195 url : baseURL + '/Roo/Core_templatestr',
197 mask : 'Processing...',
199 _rescan : sn.attributes.id.split(':')[1]
203 _this.treepanel.tree.getRootNode().reload();
208 var syncSingleTemplate = function(id){
210 url : baseURL + '/Roo/Core_template',
212 mask : 'Processing...',
220 _this.grid.footer.onClick('first');
227 if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){
228 Roo.MessageBox.progress("Syncing templates", "Starting");
233 if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){
238 if(typeof(sn.attributes.id) != 'undefined' && sn.attributes.id * 1> 0){
239 syncSingleTemplate(sn.attributes.id);
249 '|xns' : 'Roo.Toolbar'
254 '|xns' : 'Roo.Toolbar'
258 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
260 click : function (_self, e)
264 Pman.Dialog.Image.show({
265 _url : baseURL + '/Admin/Import/Core_templatestr'
268 _this.treepanel.tree.getRootNode().reload();
276 '|xns' : 'Roo.Toolbar'
281 '|xns' : 'Roo.Toolbar'
285 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
287 click : function (_self, e)
289 var tree = _this.treepanel.tree;
291 var sn = tree.getSelectionModel().getSelectedNode();
294 csvCols : 'src_id_mdsum,template_id_view_name,template_id_template,src_id_txt,lang,txt',
295 csvTitles : 'Code,Module,Template,Original,Language,Translation',
297 sort: 'template_id_view_name,template_id_template,on_table,on_col,src_id_txt',
301 if (!sn || sn.id == 'transtree') {
302 Roo.MessageBox.alert("Error", "Select language, module or page");
305 if (typeof(sn.id) == 'number') {
306 p.template_id = sn.id;
311 if (typeof(sn.id) == 'string' && sn.id.match(/^table:/)) {
312 var sns = sn.id.split(':');
315 p.csvCols = 'src_id_mdsum,on_table,on_id,on_col,src_id_txt,lang,txt';
316 p.csvTitles = 'Code,Table,Table id,Column,Original,Language,Translation';
319 if (typeof(sn.id) == 'string' && sn.id.match(/^view:/)) {
320 var sns = sn.id.split(':');
322 p.template_id_view_name = sns[2];
325 if (typeof(sn.id) == 'string' && sn.id.match(/^lang:/)) {
326 var sns = sn.id.split(':');
331 // view: {lang} : {view_name}
335 url : baseURL + '/Roo/Core_templatestr',
347 '|xns' : 'Roo.Toolbar'
352 '|xns' : 'Roo.Toolbar'
356 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
358 click : function (_self, e)
360 _this.treepanel.tree.getRootNode().reload();
365 '|xns' : 'Roo.Toolbar'
371 containerScroll : false,
376 xtype : 'AsyncTreeNode',
378 text : _this._strings['69fd71b6f79260924a32a45850a13ab7'] /* Translations (rescan this to update strings) */,
383 xtype : 'DefaultSelectionModel',
385 selectionchange : function (_self, node)
389 //if (node.id.split('/').length < 2) {
393 _this.grid.footer.onClick('first');
402 xtype : 'TreeLoader',
403 baseParams : { _tree : 1 },
404 dataUrl : baseURL + '/Roo/Core_templatestr',
405 requestMethod : 'GET',
407 beforeload : function (This, node, callback)
411 this.baseParams._tree = 1;
413 //this.baseParams.category = node.attributes.category;
415 loadexception : function (This, node, response)
417 Roo.MessageBox.alert("Error", "Problem loading tree");
432 title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
434 activate : function() {
437 _this.grid.footer.onClick('first');
444 xtype : 'EditorGrid',
445 autoExpandColumn : 'txt',
449 afteredit : function (e)
453 beforeedit : function (e)
455 /*if (e.record.data.src_id_txt.indexOf('<') > -1) {
456 // console.log("HTML EDITOR!!");
457 Pman.Dialog.CmsTranslateEditor.show(e.record);
461 var str=e.record.data.src_id_txt;
469 Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){
472 e.record.set('txt', v.txt);
476 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
479 e.record.set('txt', text);
486 if(str.length > 150){
488 Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){
490 e.record.set('txt', v.txt);
494 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
497 e.record.set('txt', text);
505 if (e.record.data.txt.replace(/\s+/, '').length) {
509 var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
512 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
514 if (tl == 'en' && !e.value.length) {
516 e.value = e.record.data.src_id_txt;
517 e.record.set('txt', e.record.data.src_id_txt);
521 Pman.GoogleTranslate(e.record.data.src_id_txt, "en", tl, function(result) {
523 _this.grid.activeEditor.setValue(result);
524 //console.log(result.translation);
534 //_this.dialog = Pman.Dialog.FILL_IN
535 if (_this.panel.active) {
536 this.footer.onClick('first');
537 // this.ds.onc.onClick('first');
540 rowdblclick : function (_self, rowIndex, e)
545 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
546 _this.grid.footer.onClick('first');
553 xtype : 'PagingToolbar',
555 displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
556 emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
568 emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
570 render : function (_self)
572 _this.searchBox = this;
574 specialkey : function (_self, e)
576 _this.grid.footer.onClick('first');
585 icon : rootURL + '/Pman/templates/images/search.gif',
587 click : function (_self, e)
589 _this.grid.footer.onClick('first');
593 '|xns' : 'Roo.Toolbar'
598 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
600 click : function (_self, e)
602 _this.searchBox.setValue('');
604 _this.grid.footer.onClick('first');
608 '|xns' : 'Roo.Toolbar'
615 sortInfo : { field : 'src_id_txt', direction: 'ASC' },
617 beforeload : function (_self, o)
620 var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
622 if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) {
623 _this.grid.ds.removeAll();
627 o.params = o.params || {};
628 o.params.lang = sn.parentNode.attributes.id.split(':')[1];
631 o.params['!src_id'] = 0;
633 if (_this.searchBox && _this.searchBox.getValue().length) {
634 o.params['_search_txt'] = _this.searchBox.getValue();
638 if(sn.attributes.on_table){
639 o.params.on_table = sn.attributes.on_table;
641 o.params.template_id = sn.attributes.id * 1;
645 update : function (_self, rec, operation)
649 if (operation != 'commit') {
654 _this.grid.getView().el.mask("Saving");
656 url : baseURL + '/Roo/Core_templatestr',
664 _this.grid.getView().el.unmask();
665 //g.getDataSource().reload();
669 _this.grid.getView().el.unmask();
670 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
682 url : baseURL + '/Roo/Core_templatestr.php',
687 xtype : 'JsonReader',
701 totalProperty : 'total',
708 xtype : 'ColumnModel',
709 dataIndex : 'src_id_txt',
710 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
711 renderer : function(v,x,r)
714 if (r.data.updated < r.data.src_id_updated) {
718 return String.format('<div style="color:'+c+'";>{0}</div>', v)
726 xtype : 'ColumnModel',
728 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
729 renderer : function(v,x,r)
733 if (r.data.updated < r.data.src_id_updated) {
737 return String.format('<div style="color:'+c+'";>{0}</div>', v)
744 xtype : 'GridEditor',
756 xtype : 'ColumnModel',
757 dataIndex : 'src_id_mdsum',
758 header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
760 renderer : function(v,x,r)