Передача фильтра при выборке по кнопке "..."

This commit is contained in:
2022-12-21 16:48:23 +06:00
parent f2e1596e30
commit b8f655f69b
3 changed files with 79 additions and 72 deletions

View File

@ -355,7 +355,7 @@ class EdtRec
button.setAttribute("value","..."); button.setAttribute("value","...");
button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;"; button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;";
button.onclick=function(thiz,nodeProp){ return function(){ button.onclick=function(thiz,nodeProp){ return function(){
thiz.callWindow(nodeProp); thiz.callWindowF(nodeProp);
};}(this,nodeProp); };}(this,nodeProp);
newCell2.appendChild( button ); newCell2.appendChild( button );
@ -529,11 +529,11 @@ class EdtRec
button.setAttribute("type","button"); button.setAttribute("type","button");
button.setAttribute("value","..."); button.setAttribute("value","...");
button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;height:100%;"; button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;height:100%;";
button.onclick=function(thiz,val1,val2){ button.onclick=function(thiz,val){
return function(){ return function(){
thiz.SelectObjects(val1,val2); thiz.SelectObjects(val);
}; };
}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n")); }(this,nodeProp.getAttribute("n"));
newCell2.appendChild(button); newCell2.appendChild(button);
td2.appendChild( table ); td2.appendChild( table );
@ -601,7 +601,7 @@ class EdtRec
button.setAttribute("type","button"); button.setAttribute("type","button");
button.setAttribute("value","..."); button.setAttribute("value","...");
button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;"; button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;";
button.onclick=function(thiz,val1,val2){return function(){thiz.SelectObjects(val1,val2);};}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n")); button.onclick=function(thiz,val){return function(){thiz.SelectObjects(val);};}(this,nodeProp.getAttribute("n"));
newCell2.appendChild(button); newCell2.appendChild(button);
td2.appendChild( table ); td2.appendChild( table );
@ -918,39 +918,22 @@ class EdtRec
//request data to fill the Object Filter //request data to fill the Object Filter
//The result can fill the filter field with complete information or a window with a further choice of the value //The result can fill the filter field with complete information or a window with a further choice of the value
SelectObjects(typeName,propname) SelectObjects(propname)
{ {
let rec=new SRec(); let nodeProp=findNodeOnPath(this.nodeMetadata, "type/properties/prop[@n='"+propname+"']");
rec.opener=this; if(nodeProp!=null)
rec.create(); this.callWindowF(nodeProp);
rec.f_State=1;
rec.f_PropName=propname;
rec.f_TypeName=typeName;
rec.win.setCenter(); //rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setParent(this.win);
let settings="";
let node=findNodeOnPath(this.nodeMetadata, "type/properties/prop[@n='"+propname+"']/type");
if(node!=null){
settings=getXMLNodeSerialisation(node);
}
rec.callData(rec.f_TypeName,settings);
/*if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+rec.f_TypeName+'"></type></metadata>'))
{
rec.showProgressBar();
}*/
} }
//Call the ShowRecord window with the parameters for the filter (not just the object name). //Call the ShowRecord window with the parameters for the filter (not just the object name).
callWindow(nodeProp) callWindowF(nodeProp)
{ {
let xmlString=""; let settings="";
let TypeName=""; let TypeName="";
let nT=findNode(nodeProp, "type"); let nT=findNode(nodeProp, "type");
if(nT!=null) if(nT!=null)
{ {
xmlString=getXMLNodeSerialisation(nT); settings=getXMLNodeSerialisation(nT);
TypeName = nT.getAttribute("n"); TypeName = nT.getAttribute("n");
}else }else
{ {
@ -959,23 +942,26 @@ class EdtRec
//Write to XML string from GUI //Write to XML string from GUI
while(true) while(true)
{ {
let sub1=BeforeFirst(xmlString,"${"); let sub1=BeforeFirst(settings,"${");
if(sub1==null) break; if(sub1==null) break;
let sub2=AfterFirst(xmlString,"}"); let sub2=AfterFirst(settings,"}");
if(sub2==null) break; if(sub2==null) break;
let val=BeforeFirst(AfterFirst(xmlString,"${"),"}"); let val=BeforeFirst(AfterFirst(settings,"${"),"}");
let obj=document.getElementById("prop_"+this.uid+"_"+val); let obj=document.getElementById("prop_"+this.uid+"_"+val);
if(obj!=null){ if(obj!=null){
xmlString=sub1+obj.value+sub2; settings=sub1+obj.value+sub2;
}else{ }else{
xmlString=sub1+sub2; settings=sub1+sub2;
} }
} }
let rec=new SRec(); let rec=new SRec();
rec.opener=this;
rec.create(); rec.create();
rec.f_Settings=xmlString; rec.f_State=1;
rec.f_PropName=nodeProp.getAttribute("n");
rec.f_Settings=settings;
rec.f_TypeName=TypeName; rec.f_TypeName=TypeName;
rec.win.setLeftTop(pageX-250,pageY-10); rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setParent(this.win); rec.win.setParent(this.win);
@ -1247,11 +1233,11 @@ class EdtRec
let node=findFirstNodeOnAttribute(this.nodeMetadata,'prop','n',prop_id); let node=findFirstNodeOnAttribute(this.nodeMetadata,'prop','n',prop_id);
if(node!==null) if(node!==null)
{ {
getCdata(node).nodeValue=id;
let name=node.getAttribute("FieldCaption"); let name=node.getAttribute("FieldCaption");
getCdata(node).nodeValue=id;
//We request data from the server to fill in the comments on the id of the record. //We request data from the server to fill in the comments on the id of the record.
let prop=document.getElementById("prop_"+this.uid+"_"+prop_id); let prop=document.getElementById("prop_"+this.uid+"_"+prop_id);
if(prop!==null) prop.value=id; if(prop!==null) prop.value = id;
//Request a comment on the record id from the server //Request a comment on the record id from the server
let xml = ''; let xml = '';
if(filter!=''){ if(filter!=''){

View File

@ -422,9 +422,7 @@ class SRec
getCdata(node).nodeValue=id; getCdata(node).nodeValue=id;
//we request data from the server to fill in the comments on the record id //we request data from the server to fill in the comments on the record id
let prop=document.getElementById('filter_'+this.uid+'_'+column_n); let prop=document.getElementById('filter_'+this.uid+'_'+column_n);
if(prop!==null) { if(prop!==null) prop.value = id;
prop.value = id;
}
//Request a comment on the record id from the server //Request a comment on the record id from the server
let xml = ''; let xml = '';
if(filter!=''){ if(filter!=''){
@ -880,7 +878,7 @@ class SRec
button.setAttribute("type","button"); button.setAttribute("type","button");
button.setAttribute("value","..."); button.setAttribute("value","...");
button.style.cssText="display:block; box-sizing: border-box; margin: 0px; padding: 0px;width:100%; height:100%; font-size: 9pt;"; button.style.cssText="display:block; box-sizing: border-box; margin: 0px; padding: 0px;width:100%; height:100%; font-size: 9pt;";
button.onclick=function(thiz,val1,val2){return function(){thiz.SelectObjects(val1,val2);};}(this,object,columnNode.getAttribute("n")); button.onclick=function(thiz,val){return function(){thiz.SelectObjects(val);};}(this,columnNode.getAttribute("n"));
newCell2.appendChild(button); newCell2.appendChild(button);
//I collect values from XML and inserting a request to the server (to fill out the dropdown). //I collect values from XML and inserting a request to the server (to fill out the dropdown).
@ -950,9 +948,9 @@ class SRec
button.setAttribute("type","button"); button.setAttribute("type","button");
button.setAttribute("value","..."); button.setAttribute("value","...");
button.style.cssText="width:30px; height:100%;margin: 0px; padding: 0px;"; button.style.cssText="width:30px; height:100%;margin: 0px; padding: 0px;";
button.onclick=function(thiz,val1,val2) button.onclick=function(thiz,val)
{ return function(){thiz.SelectObjects(val1,val2);}; { return function(){thiz.SelectObjects(val);};
}(this,object,columnNode.getAttribute("n")); }(this,columnNode.getAttribute("n"));
newCell2.appendChild(button); newCell2.appendChild(button);
//If the field is filled then we request the field header by its id //If the field is filled then we request the field header by its id
@ -1375,35 +1373,56 @@ class SRec
//request data to fill the Object Filter //request data to fill the Object Filter
//The result can fill the filter field with complete information or a window with a further choice of the value //The result can fill the filter field with complete information or a window with a further choice of the value
SelectObjects(typeName,propname) SelectObjects(propname)
{ {
let nodeColu=findNodeOnPath(this.nodeMetadata, "type/objects-list/filter/column[@n='"+propname+"']");
if(nodeColu!=null)
this.callWindowF(nodeColu);
}
//Call the ShowRecord window with the parameters for the filter (not just the object name).
callWindowF(nodeColu)
{
let settings="";
let TypeName="";
let nT=findNode(nodeColu, "type");
if(nT!=null)
{
settings=getXMLNodeSerialisation(nT);
TypeName = nT.getAttribute("n");
}else
{
TypeName=nodeColu.getAttribute("object");
}
//Write to XML string from GUI
while(true)
{
let sub1=BeforeFirst(settings,"${");
if(sub1==null) break;
let sub2=AfterFirst(settings,"}");
if(sub2==null) break;
let val=BeforeFirst(AfterFirst(settings,"${"),"}");
let obj=document.getElementById("filter_"+this.uid+"_"+val);
if(obj!=null){
settings=sub1+obj.value+sub2;
}else{
settings=sub1+sub2;
}
}
let rec=new SRec(); let rec=new SRec();
rec.opener=this; rec.opener=this;
rec.create(); rec.create();
rec.f_State=1; //rec.f_State=1; TODO then finish the job
rec.f_PropName=propname; //rec.f_PropName=nodeColu.getAttribute("n");
rec.f_TypeName=typeName; rec.f_Settings=settings;
rec.win.setCenter(); //rec.win.setLeftTop(pageX-250,pageY-10); rec.f_TypeName=TypeName;
rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setParent(this.win); rec.win.setParent(this.win);
if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+TypeName+'"></type></metadata>'))
let settings=""; {
let node=findNodeOnPath(this.nodeMetadata, "type/objects-list/filter/column[@n='"+propname+"']/type"); rec.showProgressBar();
if(node!=null){
settings=getXMLNodeSerialisation(node);
console.log("settings = "+settings);
} }
};
rec.callData(rec.f_TypeName,settings);
//if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+rec.f_TypeName+'"></type></metadata>'))
//{
// rec.showProgressBar();
//}
//the filter is sent if not 1 value has come and much it is necessary to display a window with a choice of one of them
//if the "..." button was pressed to display the showrecord.html window with the object selection mode
//wishWin = window.open("showrecord.html?name="+typeName+"&state=1&propname="+propname,typeName+Math.floor(Math.random()*1000000),"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
}
//Call the ShowRecord window with the parameters for the filter (not just the object name) //Call the ShowRecord window with the parameters for the filter (not just the object name)
//id - id records from the database //id - id records from the database
//col - Column Number //col - Column Number
@ -1426,9 +1445,9 @@ class SRec
//wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes"); //wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
let rec=new SRec(); let rec=new SRec();
rec.create(); rec.create();
//rec.f_State=1; not used
//rec.f_PropName=propname; not used
rec.f_Settings=xmlString; rec.f_Settings=xmlString;
//rec.f_State=state;
//rec.f_PropName=propname;
rec.f_TypeName=typeName; rec.f_TypeName=typeName;
rec.win.setLeftTop(pageX-250,pageY-10); rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setParent(this.win); rec.win.setParent(this.win);

View File

@ -378,7 +378,7 @@ var QRCode;
var _oContext = this._oContext; var _oContext = this._oContext;
var _htOption = this._htOption; var _htOption = this._htOption;
var nCount = oQRCode.getModuleCount(); var nCount = oQRCode.getModuleCount()+2;
var nWidth = _htOption.width / nCount; var nWidth = _htOption.width / nCount;
var nHeight = _htOption.height / nCount; var nHeight = _htOption.height / nCount;
var nRoundedWidth = Math.round(nWidth); var nRoundedWidth = Math.round(nWidth);
@ -389,7 +389,9 @@ var QRCode;
for (var row = 0; row < nCount; row++) { for (var row = 0; row < nCount; row++) {
for (var col = 0; col < nCount; col++) { for (var col = 0; col < nCount; col++) {
var bIsDark = oQRCode.isDark(row, col); var bIsDark;
if(row==0 || row==nCount-1 || col==0 || col==nCount-1) bIsDark = false;
else bIsDark = oQRCode.isDark(row-1, col-1);
var nLeft = col * nWidth; var nLeft = col * nWidth;
var nTop = row * nHeight; var nTop = row * nHeight;
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
@ -397,7 +399,7 @@ var QRCode;
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.fillRect(nLeft, nTop, nWidth, nHeight); _oContext.fillRect(nLeft, nTop, nWidth, nHeight);
// 안티 앨리어싱 방지 처리 // обработка сглаживания
_oContext.strokeRect( _oContext.strokeRect(
Math.floor(nLeft) + 0.5, Math.floor(nLeft) + 0.5,
Math.floor(nTop) + 0.5, Math.floor(nTop) + 0.5,