This commit is contained in:
2020-08-13 21:31:48 +06:00
parent c2e133debe
commit e56556f8d4
3 changed files with 56 additions and 56 deletions

View File

@ -139,8 +139,8 @@ class EdtRec
str+=' <caption><b id="caption'+this.uid+'"></b></caption>';
str+=' <thead>';
str+=' <tr bgcolor="#dadada">';
str+=' <th width="20%">'+_('Name')+'</th>';
str+=' <th width="80%">'+_('Value')+'</th>';
str+=' <th width="20%">'+trt('Name')+'</th>';
str+=' <th width="80%">'+trt('Value')+'</th>';
str+=' </tr>';
str+=' </thead>';
str+=' <tbody></tbody>';
@ -379,11 +379,11 @@ class EdtRec
select.appendChild( option );
option = document.createElement("option");
option.setAttribute("value","1");
option.appendChild(document.createTextNode(_('Yes')));
option.appendChild(document.createTextNode(trt('Yes')));
select.appendChild( option );
option = document.createElement("option");
option.setAttribute("value","0");
option.appendChild(document.createTextNode(_('Not')));
option.appendChild(document.createTextNode(trt('Not')));
select.appendChild( option );
}else
{
@ -406,7 +406,7 @@ class EdtRec
if(vt=="i4")
{
//alert2(_('Alert'),"prop name = "+nodeProp.getAttribute("n"));
//alert2(trt('Alert'),"prop name = "+nodeProp.getAttribute("n"));
//If there is a node "list" with the elements "CheckBox" then create them.
var opt=findNode(nodeProp, "options");
@ -456,7 +456,7 @@ class EdtRec
button.className='button-secondary';
button.setAttribute("type","button");
button.setAttribute("value","+");
button.setAttribute("title",_("Increase_by_1"));
button.setAttribute("title",trt("Increase_by_1"));
button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;";
button.onclick=function(inp){return function(){inp.value=getIntVal(inp.value)+1;}}(input);
@ -466,7 +466,7 @@ class EdtRec
button.className='button-secondary';
button.setAttribute("type","button");
button.setAttribute("value","-");
button.setAttribute("title",_("Decrease_by_1"));
button.setAttribute("title",trt("Decrease_by_1"));
button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;";
button.onclick=function(inp){return function(){inp.value=getIntVal(inp.value)-1;}}(input);
newCell3.appendChild( button );
@ -657,7 +657,7 @@ class EdtRec
btnSel.className='button-secondary';
btnSel.setAttribute("type","button");
btnSel.setAttribute("value","...");
btnSel.setAttribute("title",_('Upload'));
btnSel.setAttribute("title",trt('Upload'));
btnSel.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;";
newCell2.appendChild(btnSel);
@ -666,13 +666,13 @@ class EdtRec
button2.className='button-secondary';
button2.setAttribute("type","button");
button2.setAttribute("value","X");
button2.setAttribute("title",_('Delete'));
button2.setAttribute("title",trt('Delete'));
button2.style.cssText="height:22px;width:22px;margin:0px;padding:0px;";
button2.onclick=function(inp,ifr){return function(){ inp.value=''; getIframeDocument(ifr).forms["form"].reset(); }}(input,ifr);
newCell3.appendChild(button2);
//Download button
newCell4.innerHTML='<form action="'+ScriptDName+'" method="get" style="display:inline;" target="_blank"><input type="hidden" name="fn" value="10"/><input type="hidden" name="n" value="'+nodeProp.getAttribute('cd')+'"/><input type="hidden" name="t" value="'+nodeType.getAttribute('n')+'"/><input type="hidden" name="f" value="'+nodeProp.getAttribute('n')+'"/><input type="hidden" name="i" value="'+record_id+'"/><input class="button-secondary" style="height:22px;width:22px;" type="submit" title="'+_('Download')+'" value="D" /></form>'
newCell4.innerHTML='<form action="'+ScriptDName+'" method="get" style="display:inline;" target="_blank"><input type="hidden" name="fn" value="10"/><input type="hidden" name="n" value="'+nodeProp.getAttribute('cd')+'"/><input type="hidden" name="t" value="'+nodeType.getAttribute('n')+'"/><input type="hidden" name="f" value="'+nodeProp.getAttribute('n')+'"/><input type="hidden" name="i" value="'+record_id+'"/><input class="button-secondary" style="height:22px;width:22px;" type="submit" title="'+trt('Download')+'" value="D" /></form>'
td2.appendChild( tbl_b );
@ -768,7 +768,7 @@ class EdtRec
var td = document.createElement('td');
td.style.cssText="padding: 5px; vertical-align: bottom;";
td.setAttribute("colspan", "2");
if (this.record_id==-1) td.innerHTML='<label style="float: left; white-space: nowrap;"><input id="readd_'+this.uid+'" type="checkbox"> '+_('Repeat_the_addition_of_the_entry')+'</label>';
if (this.record_id==-1) td.innerHTML='<label style="float: left; white-space: nowrap;"><input id="readd_'+this.uid+'" type="checkbox"> '+trt('Repeat_the_addition_of_the_entry')+'</label>';
tr.appendChild(td);
//var td = document.createElement('td');
td.setAttribute("align","right");
@ -776,7 +776,7 @@ class EdtRec
button.className='button-secondary';
button.setAttribute("type","button");
button.style.cssText="margin:0px;margin-right:1px;";
button.setAttribute("value",_('Apply'));
button.setAttribute("value",trt('Apply'));
button.onclick=function(thiz){
return function(){
thiz.sendData();
@ -788,8 +788,8 @@ class EdtRec
button.setAttribute("type","button");
button.className='button-secondary';
button.style.cssText="margin:0px;";
button.setAttribute("value",_('Cancel'));
//button.onclick=function f_exit(this) { alert2(_('Alert'),this.win.div); }
button.setAttribute("value",trt('Cancel'));
//button.onclick=function f_exit(this) { alert2(trt('Alert'),this.win.div); }
button.onclick=function(thiz){ return function(){thiz.win.Close();};}(this);
td.appendChild( button );
tr.appendChild(td);
@ -798,13 +798,13 @@ class EdtRec
//Height adjust the height of the page
//this.win.div.style.width="400px"
//this.win.div.style.height="100px"
//alert2(_('Alert'),document.documentElement.scrollTop)
//alert2(_('Alert'),document.documentElement.clientHeight)
//alert2(trt('Alert'),document.documentElement.scrollTop)
//alert2(trt('Alert'),document.documentElement.clientHeight)
this.win.setHeight(eTable.offsetHeight+40); //this.win.div.style.height=(eTable.offsetHeight+40)+"px";
//alert2(_('Alert'),this.win.div.style.width)
//alert2(_('Alert'),this.win.div.style.height)
//alert2(trt('Alert'),this.win.div.style.width)
//alert2(trt('Alert'),this.win.div.style.height)
this.win.setCenter();
@ -1115,7 +1115,7 @@ class EdtRec
nodeProp=nodeProp.nextSibling;
}
if(count==0) alert2(_('Alert'),_("No_results_were_found_for_your_search"));
if(count==0) alert2(trt('Alert'),trt("No_results_were_found_for_your_search"));
else
if(count==1) //1 item has been selected, fill in the field.
{
@ -1153,7 +1153,7 @@ class EdtRec
var win=new TWin();
win.BuildGUI(pageX-280,pageY-7);
win.setContent(htmlString);
win.setCaption(document.createTextNode(_("Selection")));
win.setCaption(document.createTextNode(trt("Selection")));
win.setParent(this.win);
//win.obj=this
}
@ -1161,10 +1161,10 @@ class EdtRec
};
applyReq(req,fn,node,xmldoc,win)
{ //alert2(_('Alert'),"erec XML=\n"+getXMLNodeSerialisation(node));
{ //alert2(trt('Alert'),"erec XML=\n"+getXMLNodeSerialisation(node));
if (fn==-1)
{
alert2(_('Alert'),findFirstNode(node,'#cdata-section').nodeValue);
alert2(trt('Alert'),findFirstNode(node,'#cdata-section').nodeValue);
//this.pBarCnt=0;
this.hideProgressBar();
}else
@ -1204,7 +1204,7 @@ class EdtRec
this.setData(node);
}else
{
alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" );
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
this.hideProgressBar();
}
};
@ -1230,7 +1230,7 @@ class EdtRec
}
}else
{
alert2(_('Alert'),'Field "'+prop_id+'" not find!');
alert2(trt('Alert'),'Field "'+prop_id+'" not find!');
}
};
@ -1242,7 +1242,7 @@ class EdtRec
//filterName - filter name
callFilterVal(typeName,name,value,htmlid,filterName)
{
//alert2(_('Alert')," typeName="+typeName+" name="+name+" value="+value+" htmlid="+htmlid);
//alert2(trt('Alert')," typeName="+typeName+" name="+name+" value="+value+" htmlid="+htmlid);
if(value!="")
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'"><objects-list><filter>';
@ -1274,8 +1274,8 @@ class EdtRec
{
var nProps1=findFirstNode(node, 'properties')
var nProps2=findFirstNode(this.nodeMetadata, 'properties') //Since the values came in abbreviated XML
if(nProps1==null){ alert2(_('Alert'),'Error, node='+getXMLNodeSerialisation(node)); return; }
if(nProps2==null){ alert2(_('Alert'),'Error, nodeMetadata='+getXMLNodeSerialisation(this.nodeMetadata)); return; }
if(nProps1==null){ alert2(trt('Alert'),'Error, node='+getXMLNodeSerialisation(node)); return; }
if(nProps2==null){ alert2(trt('Alert'),'Error, nodeMetadata='+getXMLNodeSerialisation(this.nodeMetadata)); return; }
var nProp1=nProps1.firstChild
while(nProp1!=null)
{
@ -1406,7 +1406,7 @@ class EdtRec
//Проверяю тип дпнных и заполненость полей
if (!this.checkData(value,nodeProp.getAttribute("vt"),nodeProp.getAttribute("maybenull")))
{
alert2(_('Alert'),_("The_field_data_is_incorrect")+" \""+nodeProp.getAttribute("d")+"\"=\""+value+"\"!");
alert2(trt('Alert'),trt("The_field_data_is_incorrect")+" \""+nodeProp.getAttribute("d")+"\"=\""+value+"\"!");
return;
}
s+=' <prop n="'+nodeProp.getAttribute("n")+'"><![CDATA['+value+']]></prop>\n';
@ -1416,7 +1416,7 @@ class EdtRec
s+=' </properties>\n';
s+='</type>\n';
s+='</metadata>';
//alert2(_('Alert'),s);
//alert2(trt('Alert'),s);
if(this.request.callServer(ScriptName,s,true))
{
this.showProgressBar();
@ -1451,7 +1451,7 @@ class EdtRec
//inserting the selected record
setPropVal(id,caption,prop_id)
{
//alert2(_('Alert'),"id="+id+" caption="+caption+" prop_id="+prop_id)
//alert2(trt('Alert'),"id="+id+" caption="+caption+" prop_id="+prop_id)
var prop=document.getElementById("prop_"+this.uid+"_"+prop_id);
var propvis=document.getElementById("prop_"+this.uid+"_"+prop_id+"_visible");
if ((prop!=null)&&(propvis!=null))
@ -1477,9 +1477,9 @@ class EdtRec
let readd=document.getElementById("readd_"+this.uid);
if(readd!==null && readd.checked){
//if(!confirm(_("Successfully_added_data")+".\n"+_("Add_more")+"?")) this.win.Close();
//if(!confirm(trt("Successfully_added_data")+".\n"+trt("Add_more")+"?")) this.win.Close();
confirm2(_('Warning'),_("Successfully_added_data")+"<br>"+_("Add_more")+"?",null,function(thiz){return function(){thiz.win.Close();};}(this));
confirm2(trt('Warning'),trt("Successfully_added_data")+"<br>"+trt("Add_more")+"?",null,function(thiz){return function(){thiz.win.Close();};}(this));
}else

View File

@ -153,7 +153,7 @@
}
//Функция для перевода текста без применения GetText
function __($text)
function trt($text)
{
global $db,$lng,$Schema;
@ -184,7 +184,7 @@
return $result;
}
//Перевод для строки в которой встречаются подстроки вида: _('')
//Перевод для строки в которой встречаются подстроки вида: trt('')
function parseGT($text)
{
$result='';
@ -192,7 +192,7 @@
$from = 0; // Позиция поиска для итерации
while (true)
{
$pos1 = strpos($text, '_(', $from);
$pos1 = strpos($text, 'trt(', $from);
if($pos1 !== false)
{
$from = $pos1+3;
@ -202,7 +202,7 @@
if($pos2 !== false)
{
$result.=substr($text, $cut, $pos1 - $cut );
$result.=__(substr($text, $pos1+3, $pos2 - $pos1 - 3 ));
$result.=trt(substr($text, $pos1+3, $pos2 - $pos1 - 3 ));
$cut=$pos2+2;
$from = $pos2 + 2;
}
@ -1150,7 +1150,7 @@
if ($fn==8)//Получить отчёт как Excel.xls файл (почти тоже самое что и функция 4)
{
session_write_close(); //Разблокируем сессионный файл так как запросы могут быть достаточно долгими
//if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='') sendError(_('You are not logged in!'));
//if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='') sendError(trt('You are not logged in!'));
//Выбираем информацию о текущем пользователе
$name='';
@ -1197,7 +1197,7 @@
setFilter($f1,$f2);//заменить все значения первого фильтра значениями из второго
//Выбираем параметры фильтра (Для информирования что было заполнено)
$filter='<b>'._('Filter options').'</b><br>';
$filter='<b>'.trt('Filter options').'</b><br>';
$nextnode=$f1->firstChild;
while ($nextnode)
{ if ($nextnode->nodeName=='column')
@ -1235,7 +1235,7 @@
} catch (Exception $e)
{ sendError($e->getMessage());
}
if($res->rowCount()!=1) sendError(_('The number of records is not equal to one!').' '.$sql_query);
if($res->rowCount()!=1) sendError(trt('The number of records is not equal to one!').' '.$sql_query);
$columns=explode(",",$nextnode->getAttribute('FieldCaption'));
@ -1300,8 +1300,8 @@
fwrite($fh, ' </head>'."\n");
fwrite($fh, ' <body>'."\n");
fwrite($fh, '<b>'._('Time and date of generation').': </b><i>'.date('H:i:s m.d.Y').'</i><br>');
fwrite($fh, '<b>'._('Creator').': </b>'.$name);
fwrite($fh, '<b>'.trt('Time and date of generation').': </b><i>'.date('H:i:s m.d.Y').'</i><br>');
fwrite($fh, '<b>'.trt('Creator').': </b>'.$name);
fwrite($fh, $filter);
fwrite($fh, ' <table border="1" cellspacing="0">'."\n");
@ -1367,7 +1367,7 @@
//deleteTempFiles($dir);
}else
{
sendError(_('Not found the requested node:').' "'.$typename.'"!');
sendError(trt('Not found the requested node:').' "'.$typename.'"!');
}
}else

View File

@ -151,18 +151,18 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
//загрузился xml документ начинаем его разбирать (по id функции в документе)
let xmldoc = xmlHttpRequest.responseXML;
if(xmldoc==null){
alert2(_('Alert'),_('Wrong_XML_document')+"!\n"+xmlHttpRequest.responseText);
alert2(trt('Alert'),trt('Wrong_XML_document')+"!\n"+xmlHttpRequest.responseText);
return;
}
let node = xmldoc.documentElement;
//alert2(_('Alert'),"Данные=\n"+xmlHttpRequest.responseText);
if((node==null)||(node.getAttribute("fn")==null)) alert2(_('Alert'),_('Error')+"\n"+_('No_data')+"!\n"+xmlHttpRequest.responseText);
//alert2(trt('Alert'),"Данные=\n"+xmlHttpRequest.responseText);
if((node==null)||(node.getAttribute("fn")==null)) alert2(trt('Alert'),trt('Error')+"\n"+trt('No_data')+"!\n"+xmlHttpRequest.responseText);
else
{
var fn = node.getAttribute("fn");
if (fn=='0')
{
alert2(_('Alert'),findFirstNode(node,"#cdata-section").nodeValue);
alert2(trt('Alert'),findFirstNode(node,"#cdata-section").nodeValue);
}else if (fn=='1')
{
var tn=this.findNode(node.getAttribute("htmlid")); //Родительский узел
@ -183,11 +183,11 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
var cnt=document.getElementById(this.m_pr+tn.htmlid+'tb');
if(cnt!=null) this.createList(tn.htmlid); //Создать HTML кнопки
}else
alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" );
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
}
}else
{
alert2(_('Alert'),_('Failed_to_get_data')+"\n URL: "+url+"\n" + xmlHttpRequest.statusText);
alert2(trt('Alert'),trt('Failed_to_get_data')+"\n URL: "+url+"\n" + xmlHttpRequest.statusText);
}
}
};
@ -549,7 +549,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
//Добавить слушателя нажатия на кнопку
this.addListener=function(listener)
{ if(listener.OnClickNode==null) alert2(_('Alert'),'У объекта нет функции "OnClickNode()"!');
{ if(listener.OnClickNode==null) alert2(trt('Alert'),'У объекта нет функции "OnClickNode()"!');
this.m_ls[this.m_ls.length]=listener;
};
//Удалить слушателя
@ -651,28 +651,28 @@ function TTree(v_obj,v_pr,v_scr,v_pth,v_imgsize) //Дерево
//загрузился xml документ начинаем его разбирать (по id функции в документе)
let xmldoc = xmlHttpRequest.responseXML;
if(xmldoc==null){
alert2(_('Alert'),_('Wrong_XML_document')+"!\n"+xmlHttpRequest.responseText);
alert2(trt('Alert'),trt('Wrong_XML_document')+"!\n"+xmlHttpRequest.responseText);
return;
}
let node = xmldoc.documentElement;
if((node==null)||(node.getAttribute("fn")==null)) alert2(_('Alert'),_('Error')+"\n"+_('No_data')+"!\n"+xmlHttpRequest.responseText);
if((node==null)||(node.getAttribute("fn")==null)) alert2(trt('Alert'),trt('Error')+"\n"+trt('No_data')+"!\n"+xmlHttpRequest.responseText);
else
{
var fn = node.getAttribute("fn");
if (fn==0)
{
alert2(_('Alert'),findFirstNode(node,"#cdata-section").nodeValue);
alert2(trt('Alert'),findFirstNode(node,"#cdata-section").nodeValue);
}else
if (fn==1)
{
this.addNode(node);
this.OpenTreeOnPath(this.m_path);
}else
alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" );
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
}
}else
{
alert2(_('Alert'),_('Failed_to_get_data')+"\n URL: "+url+"\n" + xmlHttpRequest.statusText);
alert2(trt('Alert'),trt('Failed_to_get_data')+"\n URL: "+url+"\n" + xmlHttpRequest.statusText);
}
}
};
@ -905,7 +905,7 @@ function TTree(v_obj,v_pr,v_scr,v_pth,v_imgsize) //Дерево
//Добавить слушателя
this.addListener=function(listener)
{ if(listener.OnClickNode==null) alert2(_('Alert'),'У объекта нет функции "OnClickNode()"!');
{ if(listener.OnClickNode==null) alert2(trt('Alert'),'У объекта нет функции "OnClickNode()"!');
this.m_ls[this.m_ls.length]=listener;
};
//Удалить слушателя
@ -917,7 +917,7 @@ function TTree(v_obj,v_pr,v_scr,v_pth,v_imgsize) //Дерево
};
//Добавить слушателя
this.addListenerLoad=function(listener)
{ if(listener.OnLoadNode==null) alert2(_('Alert'),'У объекта нет функции "OnLoadNode(node)"!');
{ if(listener.OnLoadNode==null) alert2(trt('Alert'),'У объекта нет функции "OnLoadNode(node)"!');
this.m_lsl[this.m_lsl.length]=listener;
};
//Удалить слушателя