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,src_id_txt',
300 if (!sn || sn.id == 'transtree') {
301 Roo.MessageBox.alert("Error", "Select language, module or page");
304 if (typeof(sn.id) == 'number') {
305 p.template_id = sn.id;
310 if (sn.id.match(/^table:/)) {
311 var sns = sn.id.split(':');
314 p.csvCols = 'src_id_mdsum,on_table,on_id,on_col,src_id_txt,lang,txt';
315 p.csvTitles = 'Code,Table,Table id,Column,Language,Translation';
318 if (sn.id.match(/^view:/)) {
319 var sns = sn.id.split(':');
321 p.template_id_view_name = sns[2];
324 if (sn.id.match(/^lang:/)) {
325 var sns = sn.id.split(':');
330 // view: {lang} : {view_name}
334 url : baseURL + '/Roo/Core_templatestr',
346 '|xns' : 'Roo.Toolbar'
351 '|xns' : 'Roo.Toolbar'
355 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
357 click : function (_self, e)
359 _this.treepanel.tree.getRootNode().reload();
364 '|xns' : 'Roo.Toolbar'
370 containerScroll : false,
375 xtype : 'AsyncTreeNode',
377 text : _this._strings['69fd71b6f79260924a32a45850a13ab7'] /* Translations (rescan this to update strings) */,
382 xtype : 'DefaultSelectionModel',
384 selectionchange : function (_self, node)
388 //if (node.id.split('/').length < 2) {
392 _this.grid.footer.onClick('first');
401 xtype : 'TreeLoader',
402 baseParams : { _tree : 1 },
403 dataUrl : baseURL + '/Roo/Core_templatestr',
404 requestMethod : 'GET',
406 beforeload : function (This, node, callback)
410 this.baseParams._tree = 1;
412 //this.baseParams.category = node.attributes.category;
414 loadexception : function (This, node, response)
416 Roo.MessageBox.alert("Error", "Problem loading tree");
431 title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
433 activate : function() {
436 _this.grid.footer.onClick('first');
443 xtype : 'EditorGrid',
444 autoExpandColumn : 'txt',
448 afteredit : function (e)
452 beforeedit : function (e)
454 /*if (e.record.data.src_id_txt.indexOf('<') > -1) {
455 // console.log("HTML EDITOR!!");
456 Pman.Dialog.CmsTranslateEditor.show(e.record);
460 var str=e.record.data.src_id_txt;
468 Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){
471 e.record.set('txt', v.txt);
475 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
478 e.record.set('txt', text);
485 if(str.length > 150){
487 Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){
489 e.record.set('txt', v.txt);
493 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
496 e.record.set('txt', text);
504 if (e.record.data.txt.replace(/\s+/, '').length) {
508 var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
511 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
513 if (tl == 'en' && !e.value.length) {
515 e.value = e.record.data.src_id_txt;
516 e.record.set('txt', e.record.data.src_id_txt);
520 Pman.GoogleTranslate(e.record.data.src_id_txt, "en", tl, function(result) {
522 _this.grid.activeEditor.setValue(result);
523 //console.log(result.translation);
533 //_this.dialog = Pman.Dialog.FILL_IN
534 if (_this.panel.active) {
535 this.footer.onClick('first');
536 // this.ds.onc.onClick('first');
539 rowdblclick : function (_self, rowIndex, e)
544 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
545 _this.grid.footer.onClick('first');
552 xtype : 'PagingToolbar',
554 displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
555 emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
567 emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
569 render : function (_self)
571 _this.searchBox = this;
573 specialkey : function (_self, e)
575 _this.grid.footer.onClick('first');
584 icon : rootURL + '/Pman/templates/images/search.gif',
586 click : function (_self, e)
588 _this.grid.footer.onClick('first');
592 '|xns' : 'Roo.Toolbar'
597 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
599 click : function (_self, e)
601 _this.searchBox.setValue('');
603 _this.grid.footer.onClick('first');
607 '|xns' : 'Roo.Toolbar'
614 sortInfo : { field : 'src_id_txt', direction: 'ASC' },
616 beforeload : function (_self, o)
619 var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
621 if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) {
622 _this.grid.ds.removeAll();
626 o.params = o.params || {};
627 o.params.lang = sn.parentNode.attributes.id.split(':')[1];
630 o.params['!src_id'] = 0;
632 if (_this.searchBox && _this.searchBox.getValue().length) {
633 o.params['_search_txt'] = _this.searchBox.getValue();
637 if(sn.attributes.on_table){
638 o.params.on_table = sn.attributes.on_table;
640 o.params.template_id = sn.attributes.id * 1;
644 update : function (_self, rec, operation)
648 if (operation != 'commit') {
653 _this.grid.getView().el.mask("Saving");
655 url : baseURL + '/Roo/Core_templatestr',
663 _this.grid.getView().el.unmask();
664 //g.getDataSource().reload();
668 _this.grid.getView().el.unmask();
669 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
681 url : baseURL + '/Roo/Core_templatestr.php',
686 xtype : 'JsonReader',
700 totalProperty : 'total',
707 xtype : 'ColumnModel',
708 dataIndex : 'src_id_txt',
709 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
710 renderer : function(v,x,r)
713 if (r.data.updated < r.data.src_id_updated) {
717 return String.format('<div style="color:'+c+'";>{0}</div>', v)
725 xtype : 'ColumnModel',
727 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
728 renderer : function(v,x,r)
732 if (r.data.updated < r.data.src_id_updated) {
736 return String.format('<div style="color:'+c+'";>{0}</div>', v)
743 xtype : 'GridEditor',
755 xtype : 'ColumnModel',
756 dataIndex : 'src_id_mdsum',
757 header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
759 renderer : function(v,x,r)