This commit is contained in:
2021-11-28 20:05:03 +06:00
3 changed files with 109 additions and 90 deletions

View File

@ -2163,7 +2163,7 @@ public class DBMSRecords implements ServletContextAware {
Statement st = null;
try {
st = conn.createStatement();
String sql = "select t.translation from main._translations t where t.identifier='"+key+"' and t.language_id='"+user.language_id+"';";
String sql = "select case when '"+user.language_id+"'='666' then t.translation||'''\"' alse t.translation end as translation from main._translations t where t.identifier='"+key+"' and (t.language_id='"+user.language_id+"' or ('"+user.language_id+"'='666' and t.language_id=1));";
rs = st.executeQuery(sql);
if(rs != null) {
if (rs.next()) {

View File

@ -1,4 +1,4 @@
//Copyright (C) 2008 Ivanov I.M. irigm@mail.ru +77051809750
//Copyright (C) Ivanov I.M. irigm@mail.ru +77051809750 file created in 2008
//For find non english chars: [^\x00-\x7F]+
//Заглушки
@ -20,7 +20,7 @@ class EdtRec
this.win.setContent('<div id="eDiv'+this.uid+'" style="width: 100%; /*height: 100%;*/ position: relative;"></div>');
let eDiv=document.getElementById('eDiv'+this.uid);
eDiv.innerHTML = '<table width="100%" height="100%"><tr><td style="vertical-align:middle;" bgcolor="#F1F1F1"><center><IMG src="../resources/metadata/dbms/images/loading.gif"></center></td></tr></table>'
eDiv.innerHTML = '<table style="width:100%;height:100%"><tr><td style="vertical-align:middle;background-color:#F1F1F1"><center><IMG src="../resources/metadata/dbms/images/loading.gif"></center></td></tr></table>'
if(caption!='')
this.win.setCaption(document.createTextNode(caption));
@ -50,7 +50,7 @@ class EdtRec
{
this.pBarDiv=document.createElement('div');
this.pBarDiv.style.cssText='position: absolute; left: 0px; top: 0px; z-index: 1; background-color: rgba(0,0,0,0.5); width:100%; height: 100%;';
this.pBarDiv.innerHTML='<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="vertical-align: middle;"><img src="../resources/metadata/dbms/images/loading.gif" alt=""></td></tr></table>';
this.pBarDiv.innerHTML='<table style="width:100%;height:100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="vertical-align: middle;"><img src="../resources/metadata/dbms/images/loading.gif" alt=""></td></tr></table>';
let eDiv=document.getElementById('eDiv'+this.uid);
if(eDiv==null) return;
@ -100,6 +100,16 @@ class EdtRec
nodeProp=nodeProp.nextSibling;
}
}
//Задать новое значение GUI полю (не XML, XML выше)
setValue(propName,value){
let field=document.getElementById("prop_"+this.uid+"_"+propName);
if(field!=null)
{
field.value=value;
}else{
console.error('Field "'+propName+'" not found!');
}
}
//Apply the settings to the current node "type-> n" must match.
setXMLSettings(xml)
@ -140,8 +150,8 @@ class EdtRec
str+=' <caption><b id="caption'+this.uid+'"></b></caption>';
str+=' <thead>';
str+=' <tr bgcolor="#dadada">';
str+=' <th width="20%">'+trt('Name')+'</th>';
str+=' <th width="80%">'+trt('Value')+'</th>';
str+=' <th style="width:20%">'+trt('Name')+'</th>';
str+=' <th style="width:80%">'+trt('Value')+'</th>';
str+=' </tr>';
str+=' </thead>';
str+=' <tbody></tbody>';
@ -150,16 +160,16 @@ class EdtRec
//this.win.setContent(str);
//document.getElementById('menu').parentNode.appendChild( this.win.div )
var eTable=document.getElementById('eTable'+this.uid);
let eTable=document.getElementById('eTable'+this.uid);
var type_name=nodeType.getAttribute("n");
let type_name=nodeType.getAttribute("n");
//document.getElementById('caption'+this.uid).appendChild(document.createTextNode(nodeType.getAttribute("d")));
this.win.setCaption(document.createTextNode(nodeType.getAttribute("d")));
var nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
this.win.setWidth(nodeProperties.getAttribute("width"));
var nodeFilters=findNodeOnPath(Node,'type/objects-list/filter');
var nodeProp=null;
let nodeFilters=findNodeOnPath(Node,'type/objects-list/filter');
let nodeProp=null;
//For convenience, when adding a new record, we rewrite the values from the parent filter in the edit field.
if(nodeFilters!=null)
@ -176,10 +186,10 @@ class EdtRec
{
if (nodeFilter.getAttribute("n")==nodeProp.getAttribute("n"))
{
var cdata1=findFirstNode(nodeFilter,'#cdata-section');
let cdata1=findFirstNode(nodeFilter,'#cdata-section');
if((cdata1!=null)&&(cdata1.nodeValue!=""))
{
var cdata2=findFirstNode(nodeProp,'#cdata-section');
let cdata2=findFirstNode(nodeProp,'#cdata-section');
if (cdata2==null)
{
cdata2 = nodeProp.ownerDocument.createCDATASection("");
@ -290,7 +300,7 @@ class EdtRec
//td2.style.width=row+"px";
}
if(vt=="html"){
if(vt==="html"){
td1.innerHTML=nodeProp.getAttribute("d")+'<br><button class="button-secondary" onclick="showHTMLEditor(\''+nodeProp.getAttribute("d")+'\',\'prop_'+this.uid+'_'+nodeProp.getAttribute("n")+'\');">HTML ...</button>';
}else{
td1.innerHTML=nodeProp.getAttribute("d");
@ -302,7 +312,7 @@ class EdtRec
let value=getCdata(nodeProp).nodeValue;
if(vt=="string" || vt=="str")
if(vt==="string" || vt==="str")
{
let table=document.createElement('table');
table.style.cssText="width:100%;border-spacing:0;border-collapse:collapse;border:0px;";
@ -360,7 +370,7 @@ class EdtRec
td2.appendChild( table );
}else
if(vt=="password")
if(vt==="password")
{
let input = document.createElement('input');
input.classList.add('DBMS');
@ -371,7 +381,7 @@ class EdtRec
input.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
td2.appendChild( input );
}else
if(vt=="b")
if(vt==="b")
{
let select = document.createElement('select');
select.classList.add('DBMS');
@ -411,7 +421,7 @@ class EdtRec
select.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
td2.appendChild( select );
}else
if(vt=="i4")
if(vt==="i4")
{
//If there is a node "list" with the elements "CheckBox" then create them.
let opt=findNode(nodeProp, "options");
@ -477,7 +487,7 @@ class EdtRec
td2.appendChild( table );
}
}else
if(vt=="f4")
if(vt==="f4")
{
let input = document.createElement('input');
input.classList.add('DBMS');
@ -488,7 +498,7 @@ class EdtRec
input.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
td2.appendChild( input );
}else
if(vt=="object")
if(vt==="object")
{
let input=null;
if(nodeProp.getAttribute("selector")=="combo")
@ -530,20 +540,20 @@ class EdtRec
td2.appendChild( table );
//send a request for data (Only if creating a new record (if editing then requesting data only needs to come from the data itself because the data in the hung lists will receive data 2 times))
/*var nTypeF = findFirstNode(nodeProp, "type");
/*let nTypeF = findFirstNode(nodeProp, "type");
if(nTypeF != null) //Запрос с параметрами не можем отправить без подгрузки данных
{
//Add parameters to request
nTypeF.setAttribute("c",nodeProp.getAttribute("FieldCaption"));
nTypeF.setAttribute("pn",nodeProp.getAttribute("n"));
var strXMLF = getXMLNodeSerialisation(nTypeF);
var nColF=nodeProperties.firstChild;
let strXMLF = getXMLNodeSerialisation(nTypeF);
let nColF=nodeProperties.firstChild;
while(nColF != null)
{
if(nColF.nodeName==="prop")
{
var valF=getCdataValue(nColF);
let valF=getCdataValue(nColF);
strXMLF=strXMLF.replace('${'+nColF.getAttribute('n')+'}', valF);
}
nColF = nColF.nextSibling;
@ -555,7 +565,7 @@ class EdtRec
}
}else
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'"></type></metadata>';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'"></type></metadata>';
if(this.request.callServer(ScriptName,xml,true));
{
this.showProgressBar();
@ -599,7 +609,7 @@ class EdtRec
//We request the field title by the field id (if it is filled).
/*if ((value!="")&&(value!=-1))
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
xml+='</type></metadata>';
if(this.request.callServer(ScriptName,xml,true))
@ -609,7 +619,7 @@ class EdtRec
}*/
}
}else
if(vt=="text") {
if(vt==="text") {
let ta = document.createElement('textarea')
ta.classList.add('DBMS');
ta.setAttribute("id", "prop_" + this.uid + "_" + nodeProp.getAttribute("n"));
@ -620,7 +630,7 @@ class EdtRec
td2.appendChild(ta);
}else
if(vt=="html"){
if(vt==="html"){
let ta = document.createElement('textarea')
ta.classList.add('DBMS');
ta.setAttribute("id", "prop_" + this.uid + "_" + nodeProp.getAttribute("n"));
@ -630,12 +640,12 @@ class EdtRec
ta.setAttribute("value", value);
td2.appendChild(ta);
/*var cdv=document.createElement('div');
/*let cdv=document.createElement('div');
cdv.innerHTML+='<a href="javascript:;" onclick="return showTinyMCE(\'prop_'+this.uid+'_'+nodeProp.getAttribute("n")+'\');">[Show]</a>';
cdv.innerHTML+=' <a href="javascript:;" onclick="tinyMCE.get(\'prop_'+this.uid+'_'+nodeProp.getAttribute("n")+'\').hide(); return false;">[Hide]</a>';
td2.appendChild( cdv );*/
}else
if(vt=="blob" || vt=="file")
if(vt==="blob" || vt==="file")
{
let ifr=createIFrame("prop_"+this.uid+"_"+nodeProp.getAttribute("n")+'_frm', ScriptUName+"?fn=9", td2, false); //IFrame to send the file to the server.
document.body.appendChild(ifr);
@ -699,7 +709,7 @@ class EdtRec
if(BeforeFirst(doc.body.innerHTML,'=')=='ok')
{
var fName=BeforeFirst(AfterFirst(doc.body.innerHTML,'='),"\n");
let fName=BeforeFirst(AfterFirst(doc.body.innerHTML,'='),"\n");
inp.value=fName;//BeforeLast(inp.value,'.')+'_'+fName;
if(inp.value!='')
{ obj.sendData();
@ -709,7 +719,7 @@ class EdtRec
}(btnSel,input,this);
}else
if(vt=="date" || vt=="dateTime")
if(vt==="date" || vt==="dateTime")
{
let table=document.createElement('table');
table.style.cssText="width:100%;border-spacing:0;border-collapse:collapse;border:0px;";
@ -728,14 +738,14 @@ class EdtRec
input.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
newCell1.appendChild( input );
var img = document.createElement('img');
let img = document.createElement('img');
img.src='../resources/metadata/dbms/images/datepicker.jpg';
img.style.cssText="cursor: pointer;";
newCell2.appendChild(img);
td2.appendChild( table );
if(vt=="date")
if(vt==="date")
new Calendar({
inputField: input,
dateFormat: "%Y-%m-%d",
@ -747,7 +757,7 @@ class EdtRec
this.hide();
}
});
if(vt=="dateTime")
if(vt==="dateTime")
new Calendar({
inputField: input,
dateFormat: "%Y-%m-%d %H:%M:%S",
@ -784,7 +794,7 @@ class EdtRec
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>';
tr.appendChild(td);
//var td = document.createElement('td');
//let td = document.createElement('td');
td.setAttribute("align","right");
let button = document.createElement('input');
button.classList.add('button-secondary');
@ -839,8 +849,8 @@ class EdtRec
onComboObjectChangeHandler(node)
{
//I go through the fields and if there is a configurable query, I re-query the data
var nodeType=findFirstNode(this.nodeMetadata, "type");
var nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
let nodeType=findFirstNode(this.nodeMetadata, "type");
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
if(nodeProperties!=null) //Creating HTML elements by XML filter
{
let nodeProp=nodeProperties.firstChild;
@ -848,25 +858,25 @@ class EdtRec
{
if (nodeProp.nodeName==="prop")
{
var nTypeF = findFirstNode(nodeProp, "type");
let nTypeF = findFirstNode(nodeProp, "type");
if(nTypeF != null)
{
//Add parameters to request
nTypeF.setAttribute("c",nodeProp.getAttribute("FieldCaption"));
nTypeF.setAttribute("pn",nodeProp.getAttribute("n"));
var strXMLF = getXMLNodeSerialisation(nTypeF);
let strXMLF = getXMLNodeSerialisation(nTypeF);
if(strXMLF.indexOf('${'+node.getAttribute('n')+'}')!=-1) //If it does not participate then it does not react to the change
{
var nColF=nodeProperties.firstChild;
let nColF=nodeProperties.firstChild;
while(nColF != null)
{
if(nColF.nodeName==="prop")
{
var elm=document.getElementById('prop_'+this.uid+'_'+nColF.getAttribute("n"));
{
let elm=document.getElementById('prop_'+this.uid+'_'+nColF.getAttribute("n"));
if(elm!=null)
{
var valF=elm.value;
let valF=elm.value;
strXMLF=strXMLF.replace('${'+nColF.getAttribute('n')+'}', valF);
}
}
@ -982,20 +992,20 @@ class EdtRec
{
if(nodeProp.getAttribute("selector")=="combo")
{
var nTypeF = findFirstNode(nodeProp, "type");
let nTypeF = findFirstNode(nodeProp, "type");
if(nTypeF != null) //Запрос с параметрами не можем отправить без подгрузки данных
{
//Add parameters to request
nTypeF.setAttribute("c",nodeProp.getAttribute("FieldCaption"));
nTypeF.setAttribute("pn",nodeProp.getAttribute("n"));
var strXMLF = getXMLNodeSerialisation(nTypeF);
var nColF=nodeProperties.firstChild;
let strXMLF = getXMLNodeSerialisation(nTypeF);
let nColF=nodeProperties.firstChild;
while(nColF != null)
{
if(nColF.nodeName==="prop")
{
var valF=getCdataValue(nColF);
let valF=getCdataValue(nColF);
strXMLF=strXMLF.replace('${'+nColF.getAttribute('n')+'}', valF);
}
nColF = nColF.nextSibling;
@ -1006,8 +1016,8 @@ class EdtRec
this.showProgressBar();
}
}else
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'"></type></metadata>';
{
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'"></type></metadata>';
if(this.request.callServer(ScriptName,xml,true));
{
this.showProgressBar();
@ -1018,7 +1028,7 @@ class EdtRec
//We request the field title by the field id (if it is filled).
/*if ((value!="")&&(value!=-1))
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
xml+='</type></metadata>';
if(this.request.callServer(ScriptName,xml,true))
@ -1117,7 +1127,7 @@ class EdtRec
}else //if the field with the button
{
//count the number of values
var count=0;
let count=0;
nodeProp=nodeType.firstChild;
while (nodeProp!=null)
{
@ -1133,20 +1143,20 @@ class EdtRec
id=nodeProp.getAttribute("id");
value=findNode(nodeProp, '#cdata-section').nodeValue;
prop.value=id;
var propvis=document.getElementById("prop_"+this.uid+"_"+prop_name+"_visible");
let propvis=document.getElementById("prop_"+this.uid+"_"+prop_name+"_visible");
propvis.value=value;
propvis.select();
}else
if(count>1) //Display the item selection window.
{
var htmlString='<table width="100%" bgcolor="whitesmoke">';
let htmlString='<table width="100%" bgcolor="whitesmoke">';
nodeProp=nodeType.firstChild;
var i=0;
let i=0;
while (nodeProp!=null)
{
if (nodeProp.nodeName=="record")
{
var bgColor='whitesmoke';
let bgColor='whitesmoke';
if (i%2==0) bgColor='white';
id=nodeProp.getAttribute("id");
value=findNode(nodeProp, '#cdata-section').nodeValue;
@ -1160,7 +1170,7 @@ class EdtRec
}
htmlString+='</table>';
var win=new TWin();
let win=new TWin();
win.BuildGUI(pageX-280,pageY-7);
win.setContent(htmlString);
win.setCaption(document.createTextNode(trt("Selection")));
@ -1222,16 +1232,16 @@ class EdtRec
//Request data to fill in the field with the button
setFilterObject(TypeName,prop_id,id)
{
var node=findFirstNodeOnAttribute(this.nodeMetadata,'prop','n',prop_id);
let node=findFirstNodeOnAttribute(this.nodeMetadata,'prop','n',prop_id);
if(node!==null)
{
var name=node.getAttribute("FieldCaption");
let name=node.getAttribute("FieldCaption");
findNode(node,'#cdata-section').nodeValue=id;
//We request data from the server to fill in the comments on the id of the record.
var prop=document.getElementById("filter_"+prop_id);
let prop=document.getElementById("filter_"+prop_id);
if(prop!==null) prop.value=id;
//Request a comment on the record id from the server
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+TypeName+'" c="'+name+'" pn="'+prop_id+'" fn="'+name+'">';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+TypeName+'" c="'+name+'" pn="'+prop_id+'" fn="'+name+'">';
xml+='<objects-list><filter><column n="id"><![CDATA['+id+']]></column></filter></objects-list>';
xml+='</type></metadata>';
if(this.request.callServer(ScriptName,xml,true))
@ -1255,7 +1265,7 @@ class EdtRec
//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>';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'"><objects-list><filter>';
xml+='<column n="'+filterName+'"><![CDATA['+value+']]></column>';
xml+='</filter></objects-list></type></metadata>';
if(this.request.callServer(ScriptName,xml,true))
@ -1267,7 +1277,7 @@ class EdtRec
onCallFV(typeName,name,value,htmlid,filterName)
{
var win=this
let win=this
return function(e){
if(e==null) e=window.event;
if(e.keyCode==13){
@ -1282,16 +1292,16 @@ class EdtRec
{
if(typeof(node) != "undefined" && node!=null)
{
var nProps1=findFirstNode(node, 'properties')
var nProps2=findFirstNode(this.nodeMetadata, 'properties') //Since the values came in abbreviated XML
let nProps1=findFirstNode(node, 'properties')
let nProps2=findFirstNode(this.nodeMetadata, 'properties') //Since the values came in abbreviated XML
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
let nProp1=nProps1.firstChild
while(nProp1!=null)
{
if (nProp1.nodeName=="prop")
{
var nProp2=findNodeOnAttribute(nProps2,"prop","n",nProp1.getAttribute("n"))
let nProp2=findNodeOnAttribute(nProps2,"prop","n",nProp1.getAttribute("n"))
if(nProp2!=null) getCdata(nProp2).nodeValue=getCdata(nProp1).nodeValue
}
nProp1=nProp1.nextSibling;
@ -1305,13 +1315,13 @@ class EdtRec
//I rewrite values from XML to GIU fields
fillGUIFromXML()
{
var nodeProperties=findFirstNode(this.nodeMetadata, 'properties');
var nodeProp=nodeProperties.firstChild;
let nodeProperties=findFirstNode(this.nodeMetadata, 'properties');
let nodeProp=nodeProperties.firstChild;
while (nodeProp!=null)
{
if (nodeProp.nodeName=="prop")
{
var value=getCdata(nodeProp).nodeValue;
let value=getCdata(nodeProp).nodeValue;
//console.log("name = "+nodeProp.getAttribute("n")+" value= "+value);
if ((value=="true")||(value=="t")) value=1;
@ -1319,7 +1329,7 @@ class EdtRec
if(typeof nodeProp.field == "undefined") //Если не специализированное поле а обычные HTML поля
{
var field=document.getElementById("prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
let field=document.getElementById("prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
if(field!=null)
{
field.value=value;
@ -1332,7 +1342,7 @@ class EdtRec
//console.log("++++++++++field.options.length = "+field.options.length);
//We sort out the elements of the list (options) and set it to the desired value (the snake is not automatically exposed by the automaton).
for(var i=0;i<field.options.length;i++)
for(let i=0;i<field.options.length;i++)
{
if(field.options[i].value==value)
{
@ -1343,7 +1353,7 @@ class EdtRec
{
if ((value!="")&&(value!=-1))
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
xml+='</type></metadata>';
if(this.request.callServer(ScriptName,xml,true))
@ -1365,16 +1375,18 @@ class EdtRec
//Move data from html fields to an XML string and send to edit or update
sendData()
{
let nodeProperties;
let nodeProp;
//Send binary data sequentially for each field
var nodeProperties=findFirstNode(this.nodeMetadata, 'properties');
var nodeProp=nodeProperties.firstChild;
var sending=false;
nodeProperties=findFirstNode(this.nodeMetadata, 'properties');
nodeProp=nodeProperties.firstChild;
let sending=false;
while (nodeProp!=null)
{
if (nodeProp.nodeName=="prop" && (nodeProp.getAttribute("vt")=="blob" || nodeProp.getAttribute("vt")=="file"))
{
var frm=document.getElementById('prop_'+this.uid+'_'+nodeProp.getAttribute("n")+'_frm');
var doc=getIframeDocument(frm);
let frm=document.getElementById('prop_'+this.uid+'_'+nodeProp.getAttribute("n")+'_frm');
let doc=getIframeDocument(frm);
if(doc.forms["form"].elements["file"].value!='')
{ doc.forms["form"].submit();
sending=true;
@ -1385,20 +1397,20 @@ class EdtRec
if(sending) return;
//Sending text data
var nodeType=findFirstNode(this.nodeMetadata, 'type')
var nodename=nodeType.getAttribute("n")
var s="";
let nodeType=findFirstNode(this.nodeMetadata, 'type')
let nodename=nodeType.getAttribute("n")
let s="";
s+='<?xml version="1.0" encoding="utf-8"?>\n';
if (this.record_id!=-1) s+='<metadata fn="2">\n'; else s+='<metadata fn="1">\n';
s+='<type n="'+nodename+'" id="'+this.record_id+'">\n';
s+=' <properties>\n';
var nodeProperties=findFirstNode(this.nodeMetadata, 'properties')
var nodeProp=nodeProperties.firstChild
nodeProperties=findFirstNode(this.nodeMetadata, 'properties')
nodeProp=nodeProperties.firstChild
while (nodeProp!=null)
{
if (nodeProp.nodeName=="prop")
{
var value="";
let value="";
if(typeof nodeProp.field == "undefined")
{
value=document.getElementById("prop_"+this.uid+"_"+nodeProp.getAttribute("n")).value;
@ -1462,8 +1474,8 @@ class EdtRec
setPropVal(id,caption,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");
let prop=document.getElementById("prop_"+this.uid+"_"+prop_id);
let propvis=document.getElementById("prop_"+this.uid+"_"+prop_id+"_visible");
if ((prop!=null)&&(propvis!=null))
{
prop.value=id;
@ -1509,6 +1521,8 @@ class EdtRec
}
this.win.Close();
};
}
//Поле с галочкой (или галочками)
@ -1539,8 +1553,8 @@ class TCheckboxListField
};
// Return checked values divide ";"
getValue() {
var result = "";
for(var i=0;i<this.array.length;i++)
let result = "";
for(let i=0;i<this.array.length;i++)
{
if(this.array[i].checked)
{

View File

@ -213,6 +213,7 @@
}else
{
$db = new PDO($db_connection, $db_login, $db_password);
$db->exec("SET timezone TO 'UTC';"); //Пользователь должен сам передавать свою зону или она должна быть в настройках
}
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e)
@ -427,7 +428,11 @@
$result = $stmt->fetch(PDO::FETCH_NUM);
if($result[0]=='')
{
$result[0]=$db->lastInsertId(); //Для SQLite
if(strpos($db_connection, 'sqlite')!==false) {
$result[0] = $db->lastInsertId(); //Для SQLite
}else{
sendError(trt('Failed_to_insert_record').'!');
}
}
$xmlstring='<?xml version="1.0" encoding="utf-8"?><metadata fn="1"><type n="'.$typename.'" id="'.$result[0].'"></type></metadata>';