QRCode lib

This commit is contained in:
2022-11-04 15:41:04 +06:00
parent c8a393ccd1
commit 625548f670
4 changed files with 654 additions and 17 deletions

View File

@ -13,6 +13,7 @@ class EdtRec
constructor(caption)
{
this.uid=getUID();
this.record_id=null;
this.win=new TWin();
this.win.BuildGUI(pageX-10,pageY-10);
@ -41,6 +42,9 @@ class EdtRec
ERec_mas[this.uid]=this;
this.f_TypeName=""; //Имя редактируемого объекта (type->n attribute)
this.onInserted=null; //After insert row
this.onUpdated=null; //After update row
}
//Show progress bar
@ -787,7 +791,8 @@ class EdtRec
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"> '+trt('Repeat_the_addition_of_the_entry')+'</label>';
if (this.record_id==-1) td.innerHTML='<div id="add_plase_'+this.uid+'" style="float: left; white-space: nowrap;"><label><input id="readd_'+this.uid+'" type="checkbox"> '+trt('Repeat_the_addition_of_the_entry')+'</label></div>';
else td.innerHTML='<div id="add_plase_'+this.uid+'" style="float: left; white-space: nowrap;"></div>';
tr.appendChild(td);
//let td = document.createElement('td');
td.setAttribute("align","right");
@ -1189,7 +1194,7 @@ class EdtRec
let smallText = '';
let pos1=fullText.indexOf('[[');
let pos2=fullText.indexOf(']]');
if(pos1>0 && pos2>0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
if(fullText.indexOf("id456[[")>=0){ //Если есть идентификатор того что это перезапись
let okFunc=()=>{
@ -1507,22 +1512,23 @@ class EdtRec
{ //Update the parent
let typeNode=findFirstNode(node,"type");
let typeName=typeNode.getAttribute("n");
let id=typeNode.getAttribute("id");
this.record_id=typeNode.getAttribute("id"); //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.
{
this.opener.sendFilter(id,-1); //Update data by filter with id records.
this.opener.sendFilter(this.record_id,-1); //Update data by filter with id records.
}
}
let readd=document.getElementById("readd_"+this.uid);
if(readd!==null && readd.checked){
confirm2(trt('Warning'),trt("Successfully_added_data")+"<br>"+trt("Add_more")+"?",'',null,()=>this.win.Close());
confirm2(trt('Warning'),trt("Successfully_added_data")+"<br>"+trt("Add_more")+"?",'',()=>{this.record_id=-1},()=>this.win.Close());
}else
{
this.win.Close();
}
if(this.onInserted!=null) this.onInserted(this);
};
//The data has been updated successfully now telling the parent to update the record.
@ -1539,9 +1545,8 @@ class EdtRec
}
}
this.win.Close();
if(this.onUpdated!=null) this.onUpdated(this);
};
}
//Поле с галочкой (или галочками)

View File

@ -815,7 +815,16 @@
{
if(array_key_exists ( $nextnode->getAttribute("n"), $row) || ($nextnode->getAttribute("vt")=="file" && array_key_exists ( $nextnode->getAttribute("cd"), $row)))
{
if($nextnode->getAttribute("vt")=="b"){ if($row[$nextnode->getAttribute("n")]===false) { $row[$nextnode->getAttribute("n")]="0"; } else if($row[$nextnode->getAttribute("n")]===true) { $row[$nextnode->getAttribute("n")]="1"; } }
if($nextnode->getAttribute("vt")=="b")
{
if($row[$nextnode->getAttribute("n")]===false)
{
$row[$nextnode->getAttribute("n")]="0";
} else if($row[$nextnode->getAttribute("n")]===true)
{
$row[$nextnode->getAttribute("n")]="1";
}
}
if($nextnode->getAttribute("vt")=="blob") { //Только blob не file так как file как обычная текстовая строка (100 символов)
if(array_key_exists($nextnode->getAttribute("cd"), $row)) {

View File

@ -42,6 +42,9 @@ class SRec
this.uid=getUID();
this.request = new TRequest(this);
SRec_mas[this.uid]=this;
this.onUpdate=null; //For call set function
this.onInsert=null; //For call set function
}
applyReq(req,fn,node,xmldoc)
@ -56,7 +59,7 @@ class SRec
let smallText = '';
let pos1=fullText.indexOf('[[');
let pos2=fullText.indexOf(']]');
if(pos1>0 && pos2>0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
if(fullText.indexOf("id456[[")>=0){ //Если есть идентификатор того что это перезапись
let okFunc=()=>{
@ -1583,17 +1586,21 @@ class SRec
erec.opener=this;
erec.eRecNo(this.nodeMetadata,-1);
erec.win.setParent(this.win);
if(this.onInsert!=null) this.onInsert(erec);
}
updateRecord(id)
{
if(this.f_State=="0") //editing
{
let eRec = new EdtRec("");
eRec.win.setParent(this.win);
eRec.opener=this;
eRec.eRecNo(this.nodeMetadata,id);
let erec = new EdtRec("");
erec.win.setParent(this.win);
erec.opener=this;
erec.eRecNo(this.nodeMetadata,id);
//e.win.setLeftTop(pageX-10,pageY-10);
if(this.onInsert!=null) this.onUpdate(erec);
}else
if(this.f_State=="1") //select one record
{
@ -1613,11 +1620,13 @@ class SRec
this.opener.setFilterObject(this.f_TypeName, this.f_PropName, id, filter);
this.win.Close();
}else{
let eRec = new EdtRec("");
eRec.win.setParent(this.win);
eRec.opener=this;
eRec.eRecNo(this.nodeMetadata,id);
let erec = new EdtRec("");
erec.win.setParent(this.win);
erec.opener=this;
erec.eRecNo(this.nodeMetadata,id);
//e.win.setLeftTop(pageX-10,pageY-10);
if(this.onInsert!=null) this.onUpdate(erec);
}
}else
if(this.f_State=="2") //Multiple choice (on the records of ticking TODO is not implemented)