Правки при переделки в класс

This commit is contained in:
2020-03-01 18:25:22 +06:00
parent 0fba5eac2a
commit 7ad6018737
2 changed files with 16 additions and 16 deletions

View File

@ -296,6 +296,7 @@ class EdtRec
//td2.style.width=row+"px"; //td2.style.width=row+"px";
} }
td1.appendChild(document.createTextNode(nodeProp.getAttribute("d"))); td1.appendChild(document.createTextNode(nodeProp.getAttribute("d")));
if(nodeProp.getAttribute("t")!=null) td1.title=nodeProp.getAttribute("t");
if (nodeProp.getAttribute("maybenull")=='0') td1.style.cssText="font-weight: bold;"; if (nodeProp.getAttribute("maybenull")=='0') td1.style.cssText="font-weight: bold;";
var value=getCdata(nodeProp).nodeValue; var value=getCdata(nodeProp).nodeValue;

View File

@ -407,11 +407,11 @@ class SRec
//The function to collect data from HTML fields in XML //The function to collect data from HTML fields in XML
appendFilter() appendFilter()
{ {
nodeType=findFirstNode(this.nodeMetadata, "type"); let nodeType=findFirstNode(this.nodeMetadata, "type");
nodeFilter=findNodeOnPath(nodeType,"objects-list/filter"); let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter");
if (nodeFilter!=null) if (nodeFilter!=null)
{ {
columnNode=nodeFilter.firstChild; let columnNode=nodeFilter.firstChild;
while (columnNode != null) while (columnNode != null)
{ {
if (columnNode.nodeName=="column") if (columnNode.nodeName=="column")
@ -429,7 +429,6 @@ class SRec
if(isNaN(value)) value=''; if(isNaN(value)) value='';
} }
} }
getCdata(columnNode).nodeValue=value; //TODO do check for data type getCdata(columnNode).nodeValue=value; //TODO do check for data type
} }
columnNode = columnNode.nextSibling; columnNode = columnNode.nextSibling;
@ -687,7 +686,7 @@ class SRec
{ {
if(opt.nodeName=="option") if(opt.nodeName=="option")
{ {
option = document.createElement("option"); let option = document.createElement("option");
option.setAttribute("value",opt.getAttribute("val")); option.setAttribute("value",opt.getAttribute("val"));
if(opt.getAttribute("val")==value) option.selected=true; if(opt.getAttribute("val")==value) option.selected=true;
option.appendChild(document.createTextNode(opt.getAttribute("d"))); option.appendChild(document.createTextNode(opt.getAttribute("d")));
@ -1100,9 +1099,10 @@ class SRec
if(pagecount>1) if(pagecount>1)
{ {
let newRow=tablepages.insertRow(-1); let newRow=tablepages.insertRow(-1);
for(i=0;i<pagecount;i++) for(let i=0;i<pagecount;i++)
{ {
if (i%2==0) bgColor='#EEEEEE'; else bgColor='#DDDDDD'; let bgColor='#DDDDDD';
if (i%2==0) bgColor='#EEEEEE';
if (this.pagepos==i) bgColor='DodgerBlue'; if (this.pagepos==i) bgColor='DodgerBlue';
let newCell = newRow.insertCell(-1); let newCell = newRow.insertCell(-1);
newCell.setAttribute("bgColor",bgColor); newCell.setAttribute("bgColor",bgColor);
@ -1143,14 +1143,14 @@ class SRec
//Add new entries //Add new entries
let nColor=findNumNodeOnAttribute(findNodeOnPath(this.nodeMetadata,"type/objects-list"),"column","n","color"); let nColor=findNumNodeOnAttribute(findNodeOnPath(this.nodeMetadata,"type/objects-list"),"column","n","color");
let TypeName = nodeType.getAttribute("n"); let TypeName = nodeType.getAttribute("n");
i=0; //The position should be received from the server. let i=0; //The position should be received from the server.
let nodeRecord = nodeType.firstChild; let nodeRecord = nodeType.firstChild;
while (nodeRecord != null) while (nodeRecord != null)
{ {
if(nodeRecord.nodeName=="record") if(nodeRecord.nodeName=="record")
{ {
bgColor=''; let bgColor='';
let i=theTable.rows.length; //number of rows in the table let i=theTable.rows.length; //number of rows in the table
if (i%2==0) bgColor='white'; else bgColor='whitesmoke'; if (i%2==0) bgColor='white'; else bgColor='whitesmoke';
@ -1219,7 +1219,7 @@ class SRec
return function(){ return function(){
obj.callWindow(val1,val2); obj.callWindow(val1,val2);
} }
}(this,id,i); }(this,id,colN);
}else }else
{ {
if((this.f_pU=="1" && nodeRecord.getAttribute("a").indexOf("u")!=-1)||(this.f_State=="1")) if((this.f_pU=="1" && nodeRecord.getAttribute("a").indexOf("u")!=-1)||(this.f_State=="1"))
@ -1231,11 +1231,10 @@ class SRec
{ {
td.style.cssText="cursor: default;"; td.style.cssText="cursor: default;";
} }
} }
tr.appendChild(td); tr.appendChild(td);
} }
i++; colN++;
} }
cdataNode = cdataNode.nextSibling; cdataNode = cdataNode.nextSibling;
} }
@ -1284,7 +1283,7 @@ class SRec
callWindow(id,col) callWindow(id,col)
{ {
//we represent xml as a string and replace values of type $ {id} with values from the current record //we represent xml as a string and replace values of type $ {id} with values from the current record
typeName=this.masCT[col].getAttribute("n"); let typeName=this.masCT[col].getAttribute("n");
let xmlString=getXMLNodeSerialisation(this.masCT[col]); let xmlString=getXMLNodeSerialisation(this.masCT[col]);
while(true) while(true)
{ {
@ -1439,9 +1438,9 @@ class SRec
this.appendFilter(); this.appendFilter();
//Call data from server //Call data from server
nodeType=findFirstNode(this.nodeMetadata, "type"); let nodeType=findFirstNode(this.nodeMetadata, "type");
typename=nodeType.getAttribute("n"); let typename=nodeType.getAttribute("n");
nodeFilter=findNodeOnPath(nodeType,"objects-list/filter"); let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter");
let xs=''; let xs='';
xs+='<?xml version="1.0" encoding="utf-8"?>\n'; xs+='<?xml version="1.0" encoding="utf-8"?>\n';
xs+='<metadata fn="8">\n'; xs+='<metadata fn="8">\n';