+ MPDF 6.1

This commit is contained in:
2020-08-11 18:04:59 +06:00
parent 11d3f0fc7a
commit c2e133debe
714 changed files with 120510 additions and 93145 deletions

View File

@ -5,7 +5,7 @@
-webkit-box-sizing: border-box;
}
html,body
/*html,body
{
height:100%;
min-height:100%;
@ -14,7 +14,7 @@ html,body
font-size: 14px;
font-family: Arial;
background-color: var(--back-color);
}
}*/
input,textarea
{
@ -62,8 +62,10 @@ select
input[type="text"], input[type="password"], textarea, select {
background-color : var(--back-color3);
color : var(--main-font-color);
border-color: rgb(195, 195, 195);
border-width: 1px;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {

View File

@ -406,7 +406,7 @@ class EdtRec
if(vt=="i4")
{
//alert("prop name = "+nodeProp.getAttribute("n"));
//alert2(_('Alert'),"prop name = "+nodeProp.getAttribute("n"));
//If there is a node "list" with the elements "CheckBox" then create them.
var opt=findNode(nodeProp, "options");
@ -789,7 +789,7 @@ class EdtRec
button.className='button-secondary';
button.style.cssText="margin:0px;";
button.setAttribute("value",_('Cancel'));
//button.onclick=function f_exit(this) { alert(this.win.div); }
//button.onclick=function f_exit(this) { alert2(_('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"
//alert(document.documentElement.scrollTop)
//alert(document.documentElement.clientHeight)
//alert2(_('Alert'),document.documentElement.scrollTop)
//alert2(_('Alert'),document.documentElement.clientHeight)
this.win.setHeight(eTable.offsetHeight+40); //this.win.div.style.height=(eTable.offsetHeight+40)+"px";
//alert(this.win.div.style.width)
//alert(this.win.div.style.height)
//alert2(_('Alert'),this.win.div.style.width)
//alert2(_('Alert'),this.win.div.style.height)
this.win.setCenter();
@ -1115,7 +1115,7 @@ class EdtRec
nodeProp=nodeProp.nextSibling;
}
if(count==0) alert(_("No_results_were_found_for_your_search"));
if(count==0) alert2(_('Alert'),_("No_results_were_found_for_your_search"));
else
if(count==1) //1 item has been selected, fill in the field.
{
@ -1161,10 +1161,10 @@ class EdtRec
};
applyReq(req,fn,node,xmldoc,win)
{ //alert("erec XML=\n"+getXMLNodeSerialisation(node));
{ //alert2(_('Alert'),"erec XML=\n"+getXMLNodeSerialisation(node));
if (fn==-1)
{
alert(findFirstNode(node,'#cdata-section').nodeValue);
alert2(_('Alert'),findFirstNode(node,'#cdata-section').nodeValue);
//this.pBarCnt=0;
this.hideProgressBar();
}else
@ -1204,7 +1204,7 @@ class EdtRec
this.setData(node);
}else
{
alert("Unknown function! fn=\""+fn+"\"" );
alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" );
this.hideProgressBar();
}
};
@ -1230,7 +1230,7 @@ class EdtRec
}
}else
{
alert('Field "'+prop_id+'" not find!');
alert2(_('Alert'),'Field "'+prop_id+'" not find!');
}
};
@ -1242,7 +1242,7 @@ class EdtRec
//filterName - filter name
callFilterVal(typeName,name,value,htmlid,filterName)
{
//alert(" typeName="+typeName+" name="+name+" value="+value+" htmlid="+htmlid);
//alert2(_('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){ alert('Error, node='+getXMLNodeSerialisation(node)); return; }
if(nProps2==null){ alert('Error, nodeMetadata='+getXMLNodeSerialisation(this.nodeMetadata)); return; }
if(nProps1==null){ alert2(_('Alert'),'Error, node='+getXMLNodeSerialisation(node)); return; }
if(nProps2==null){ alert2(_('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")))
{
alert(_("The_field_data_is_incorrect")+" \""+nodeProp.getAttribute("d")+"\"=\""+value+"\"!");
alert2(_('Alert'),_("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>';
//alert(s);
//alert2(_('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)
{
//alert("id="+id+" caption="+caption+" prop_id="+prop_id)
//alert2(_('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))
@ -1464,9 +1464,9 @@ class EdtRec
//The data was successfully added to the parent now so that he added 1 entry to the end of his list.
insertRows(node)
{ //Update the parent
var typeNode=findFirstNode(node,"type");
var typeName=typeNode.getAttribute("n");
var id=typeNode.getAttribute("id");
let typeNode=findFirstNode(node,"type");
let typeName=typeNode.getAttribute("n");
let id=typeNode.getAttribute("id");
if (this.opener!=null)
{
if(this.opener.f_TypeName==typeName) //It would be better to make an array of open windows then check for all and not just for the parent.
@ -1475,10 +1475,13 @@ class EdtRec
}
}
var readd=document.getElementById("readd_"+this.uid);
if(readd!==null && readd.checked)
{
if(!confirm(_("Successfully_added_data")+".\n"+_("Add_more")+"?")) this.win.Close();
let readd=document.getElementById("readd_"+this.uid);
if(readd!==null && readd.checked){
//if(!confirm(_("Successfully_added_data")+".\n"+_("Add_more")+"?")) this.win.Close();
confirm2(_('Warning'),_("Successfully_added_data")+"<br>"+_("Add_more")+"?",null,function(thiz){return function(){thiz.win.Close();};}(this));
}else
{
this.win.Close();

View File

@ -1,8 +1,21 @@
function TUser()
class DBMSUser
{
constructor(){
this.divsh=null;
this.id=null;
this.name='';
this.surname='';
this.patronymic='';
this.temp=false;
this.role='';
this.m_ls=new Array(); //Listeners called OnLogin function.
this.applyReq=function(req,fn,node)
//Запрашиваю данные о текущем пользователе с сервера
//this.LoadData();
}
applyReq(req,fn,node)
{
//alert(getXMLNodeSerialisation(node));
this.showShadow(false);
@ -72,7 +85,7 @@ function TUser()
};
//Display login and registration form
this.showLoginForm = function()
showLoginForm()
{
if(this.win==null || this.win.closed)
{
@ -141,7 +154,7 @@ function TUser()
}
};
//logout current user
this.Logout = function()
Logout()
{
xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[1]]></cmd></metadata>';
var request=new TRequest(this);
@ -152,13 +165,13 @@ function TUser()
};
//Checking the session without its extension, if it is completed, we display the authorization window.
this.checkSession = function()
checkSession()
{
$.getJSON('../session',{},function(thiz){return function(data){ if(data.result=='ERROR'){thiz.showLoginForm();} };}(this));
setTimeout(function(thiz){return function(){thiz.checkSession();};}(this), 10000);
};
this.showShadow = function(visible)
showShadow(visible)
{
if(visible)
{
@ -172,7 +185,7 @@ function TUser()
};
//Функция запрашивает информацию о текущем пользователе с сервера
this.LoadData = function()
LoadData()
{
var r = new TRequest(this);
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
@ -182,7 +195,7 @@ function TUser()
}
};
//Check whether the already authorized (+ attempt to log in through "hash").
this.isLogined=function()
isLogined()
{
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
var request=new TRequest(this);
@ -196,30 +209,18 @@ function TUser()
}
};
this.addListener=function(l)
addListener(l)
{ if(l.OnLogin==null) alert('Object does not have the function "OnLogin()"!');
this.m_ls[this.m_ls.length]=l;
};
this.remListener=function(l)
{ for(i=0;i<this.m_ls.length;i++)
{ if(this.m_ls[i]==l)
remListener(l){
for(let i=0;i<this.m_ls.length;i++){
if(this.m_ls[i]==l)
this.m_ls[i]=null;
}
};
this.divsh=null;
this.id=null;
this.name='';
this.surname='';
this.patronymic='';
this.temp=false;
this.role='';
this.m_ls=new Array(); //Listeners called OnLogin function.
//Запрашиваю данные о текущем пользователе с сервера
//this.LoadData();
};
}
/*
@ -493,7 +494,10 @@ function showRestoreForm()
//загрузился xml документ начинаем его разбирать (по id функции в документе)
var xmldoc = xmlHttpRequest.responseXML
if(xmldoc==null) alert(_('Wrong_XML_document')+"!\n"+xmlHttpRequest.responseText);
if(xmldoc==null) {
alert2(_('Alert'), _('Wrong_XML_document') + "!\n" + xmlHttpRequest.responseText);
return;
}
var node = xmldoc.documentElement;
if((node==null)||(node.getAttribute("fn")==null)) alert(_('Error')+"\n "+_("No_data")+"!\n"+xmlHttpRequest.responseText);

View File

@ -25,7 +25,7 @@ function CheckSession(path)
clearTimeout(this.timer);
//alert('Ваша сессия завершилась!');
//location.reload();
alert2('Ваша сессия завершилась! При нажатии на “OK” страница перезагрузится, а при нажатии на “X“ закроется сообщение.').onclick=function(){ location.reload(); };
alert2(_("Alert"),'Ваша сессия завершилась! При нажатии на “OK” страница перезагрузится, а при нажатии на “X“ закроется сообщение.').onclick=function(){ location.reload(); };
}
}
}

View File

@ -46,17 +46,17 @@ class SRec
applyReq(req,fn,node,xmldoc)
{
//alert(getXMLNodeSerialisation(node));
//alert2(_('Alert'),getXMLNodeSerialisation(node));
this.hideProgressBar();
this.xmldoc=node.ownerDocument; //xmldoc;
if (fn==-1) //Information menu
{
alert(findFirstNode(node,'#cdata-section').nodeValue);
alert2(_('Alert'),findFirstNode(node,'#cdata-section').nodeValue);
}else
if (fn==0)
{
//alert(getXMLNodeSerialisation(node));
//alert2(_('Alert'),getXMLNodeSerialisation(node));
this.setMetadata(node);
this.updateSize();
}else
@ -84,7 +84,7 @@ class SRec
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: #f1f1f1;"><tr><td align="center"><a href="'+findFirstNode(node,'#cdata-section').nodeValue+'">'+_('Download_report')+': "'+this.win.getCaption().innerHTML+'".</a></td></tr></table>');
}
}else
alert("Unknown function! fn=\""+fn+"\"" );
alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" );
}
//Edit the GUI filter from the xml string.
@ -234,7 +234,7 @@ class SRec
//Function to fill the drop-down lists (here it is necessary to ensure that everywhere there is a "var" in front of the variables).
setDataSelect(node)
{
//alert("setDataSelect = " + getXMLNodeSerialisation(node));
//alert2(_('Alert'),"setDataSelect = " + getXMLNodeSerialisation(node));
let nodeType,prop_id,prop,option,nodeProp,id,value,cdataNode;
nodeType=findFirstNode(node, 'type');
@ -247,7 +247,7 @@ class SRec
let nodeCur=findNodeOnAttribute(nodeFilter, 'column', 'n', prop_id);
if(nodeCur!=null) selector=nodeCur.getAttribute("selector");
//alert("nodeCur = " + getXMLNodeSerialisation(nodeCur));
//alert2(_('Alert'),"nodeCur = " + getXMLNodeSerialisation(nodeCur));
/*nodeCur=nodeFilter.firstChild
while(nodeCur!=null)
@ -324,7 +324,7 @@ class SRec
}
if(count==0)
{
alert(_("No_results_were_found_for_your_search"));
alert2(_('Alert'),_("No_results_were_found_for_your_search"));
}else
if(count==1) //fill without window
{
@ -401,7 +401,7 @@ class SRec
}
}else
{
alert('Filter "'+prop_id+'" not find!');
alert2(_('Alert'),'Filter "'+prop_id+'" not find!');
}
}
@ -435,7 +435,7 @@ class SRec
columnNode = columnNode.nextSibling;
}
}
//alert(getXMLNodeSerialisation(this.nodeMetadata));
//alert2(_('Alert'),getXMLNodeSerialisation(this.nodeMetadata));
}
/** Function to send filter data to the server
@ -476,7 +476,7 @@ class SRec
xs+='</filter></objects-list></type>\n';
xs+='</metadata>';
//alert(xs);
//alert2(_('Alert'),xs);
if(this.request.callServer(ScriptName,xs))
{
@ -494,7 +494,7 @@ class SRec
let td,tr,td1,td2;
let nodeFilter=null;
let tablefilter=document.getElementById('idfilter'+this.uid);
if (tablefilter.tBodies==null) alert('tablefilter=null');
if (tablefilter.tBodies==null) alert2(_('Alert'),'tablefilter=null');
let nodeType=findFirstNode(node, "type");
this.f_pI=nodeType.getAttribute("ins");//access rights
this.f_pU=nodeType.getAttribute("upd");
@ -507,7 +507,15 @@ class SRec
if(this.f_pI!='1') deleteHTML('SRec_Add_'+this.uid);
if(this.f_pD!='1') deleteHTML('SRec_Del_'+this.uid);
this.nodeMetadataObjList=findNode(nodeType, "objects-list");
if(this.win!=null) this.win.setWidth(this.nodeMetadataObjList.getAttribute("width"));
if(this.win!=null) {
this.win.setWidth(this.nodeMetadataObjList.getAttribute("width"));
let height=this.nodeMetadataObjList.getAttribute("height");
if(height!=null){
if(height.indexOf('%')!=-1)
height=(window.innerHeight / 100) * parseInt(height.substring(0,height.length-1));
this.win.setHeight(height);
}
}
nodeFilter=findNodeOnPath(nodeType,"objects-list/filter");
@ -885,7 +893,7 @@ class SRec
}
td2.appendChild( table );
}else alert("Unknown type = "+columnNode.getAttribute("vt"));
}else alert2(_('Alert'),"Unknown type = "+columnNode.getAttribute("vt"));
tablefilter.tBodies[0].appendChild(tr);
}
columnNode = columnNode.nextSibling;
@ -1052,16 +1060,16 @@ class SRec
th.appendChild( document.createTextNode(columnNode.getAttribute("d")));
th.style.cssText='width: '+columnNode.getAttribute("width")+'px;';
if(this.nodeMetadataObjList.getAttribute('order')==columnNode.getAttribute('n')) { th.style.backgroundColor='#afafaf'; }
if(columnNode.getAttribute("order")!=null && columnNode.getAttribute("order")!='')
{
th.style.textDecoration='underline';
th.style.backgroundColor='var(--btn-color)';
th.style.cursor='pointer';
th.onclick=function(thiz,cName){ return function(){ findNodeOnPath(thiz.nodeMetadata,"type/objects-list").setAttribute('order',cName); thiz.appendFilter(); thiz.sendFilter(-1,0);}; }(this,columnNode.getAttribute("n"));
th.onmouseover=function(){ this.style.backgroundColor="var(--btn-color2)"; };
th.onmouseout=function(thiz,cName){ return function(){ if(findNodeOnPath(thiz.nodeMetadata,"type/objects-list").getAttribute('order') == cName) this.style.backgroundColor='#afafaf'; else this.style.backgroundColor='#dadada'; }; }(this,columnNode.getAttribute("n"));
th.onmouseout=function(thiz,cName){ return function(){ if(findNodeOnPath(thiz.nodeMetadata,"type/objects-list").getAttribute('order') == cName) this.style.backgroundColor='var(--btn-color2)'; else this.style.backgroundColor='var(--btn-color)'; }; }(this,columnNode.getAttribute("n"));
}
if(this.nodeMetadataObjList.getAttribute('order')==columnNode.getAttribute('n')) { th.style.backgroundColor='var(--btn-color2)'; }
tr.appendChild(th);
}
pos++;
@ -1107,12 +1115,12 @@ class SRec
let newRow=tablepages.insertRow(-1);
for(let i=0;i<pagecount;i++)
{
let bgColor='#DDDDDD';
if (i%2==0) bgColor='#EEEEEE';
let bgColor='var(--btn-color)';
if (i%2==0) bgColor='var(--btn-color3)';
if (this.pagepos==i) bgColor='DodgerBlue';
let newCell = newRow.insertCell(-1);
newCell.setAttribute("bgColor",bgColor);
newCell.style.cssText="cursor: pointer;";
newCell.style.backgroundColor = bgColor;
newCell.style.cursor="pointer";
newCell.appendChild(document.createTextNode(i+1));
//Upon clicking, a filter with old values is used only with a different page number.
newCell.onclick=function(obj,page){
@ -1122,11 +1130,11 @@ class SRec
};
}(this,i);
newCell.onmouseover=function(){
this.setAttribute("bgColor","#AAAAFF");
this.style.backgroundColor = "#AAAAFF";
};
newCell.onmouseout=function(val1,val2){
return function(){
val1.setAttribute("bgColor",val2);
val1.style.backgroundColor = val2;
};
}(newCell,bgColor);
if((i+1)%40==0) newRow=tablepages.insertRow(-1);
@ -1427,7 +1435,7 @@ class SRec
dataalert()
{
let error_msg="";
if (error_msg!="") alert("ShowRecords: \n"+error_msg);
if (error_msg!="") alert2(_('Alert'),"ShowRecords: \n"+error_msg);
}
showreport(ext)
@ -1500,7 +1508,7 @@ class SRec
if(this.f_State=="1") //select one record
{
//Send the id of the selected record to the parent of the selected record and close the window
//alert("id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName);
//alert2(_('Alert'),"id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName);
this.opener.setFilterObject(this.f_TypeName,this.f_PropName,id);
this.win.Close();
}else
@ -1594,7 +1602,7 @@ function nodeToTable(node)
if(cdataNode.nodeName=="#cdata-section")
{
result[pos][cols[i]]=cdataNode.nodeValue;
//alert(pos+') '+cols[i]+' = '+cdataNode.nodeValue);
//alert2(_('Alert'),pos+') '+cols[i]+' = '+cdataNode.nodeValue);
i++;
}
cdataNode = cdataNode.nextSibling;

View File

@ -166,11 +166,11 @@ function loadContent(url,obj)
}
//Вывести текст поверх окон с кнопочкой OK
function alert2(text)
function alert2(title,text)
{
let win=new TWin();
let win=new TWin(true);
win.BuildGUI(10,10);
win.setCaption(document.createTextNode("Alert"));
win.setCaption(document.createTextNode(title));
let html='\n\
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
<tr>\n\
@ -178,7 +178,7 @@ function alert2(text)
</tr>\n\
<tr style="height: 10px;">\n\
<td style="width: 100%;">&nbsp;</td>\n\
<td><button id="'+win.uid+'_close" style="width: 80; height: 25;">OK</button></td>\n\
<td><button class="button-secondary" id="'+win.uid+'_close" style="width: 80px;">'+_('OK')+'</button></td>\n\
</tr>\n\
</table>';
@ -192,6 +192,51 @@ function alert2(text)
return obj;
}
//Вывести текст поверх окон с кнопочкой OK
function confirm2(title,text,okFunc,cancelFunc)
{
let win=new TWin();
win.BuildGUI(10,10);
win.setCaption(document.createTextNode(title));
let html='\n\
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
<tr style="width: 100%;">\n\
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+text+'</td>\n\
</tr>\n\
<tr style="height: 10px;">\n\
<td style="width: 100%;">&nbsp;</td>\n\
<td><button class="button-secondary" id="'+win.uid+'_ok" style="width: 80px;">'+_('OK')+'</button></td>\n\
\<td><button class="button-secondary" id="'+win.uid+'_cancel" style="width: 80px;">'+_('Cancel')+'</button></td>\n\
</tr>\n\
</table>';
win.setContent(html);
let btnO=document.getElementById(win.uid+'_ok');
if(btnO!=null){
btnO.onclick=function(win){
return function(){
win.Close();
if(okFunc!=null) okFunc();
};
}(win,okFunc);
}
let btnC=document.getElementById(win.uid+'_cancel');
if(btnC!=null) {
btnC.onclick = function (win) {
return function () {
win.Close();
if(cancelFunc!=null) cancelFunc();
};
}(win,cancelFunc);
}
win.setSize("300px","150px");
win.setCenter();
win.shadow=true;
win.hide(false);
return win;
}
/**
* Добавить событие к объекту
* @param {object} obj Объект
@ -937,7 +982,7 @@ class TRequest
//загрузился xml документ начинаем его разбирать (по id функции в документе)
var xmldoc = xmlHttpRequest.responseXML;
if(xmldoc==null){
alert(_('Wrong_XML_document')+"!\nXML=("+xmlHttpRequest.responseText+')\nURL=('+url+')\nxmlString=('+xmlString+')');
alert2(_('Alert'),_('Wrong_XML_document')+"!\nXML=("+xmlHttpRequest.responseText+')\nURL=('+url+')\nxmlString=('+xmlString+')');
return;
}