Сохранение настроек фильтра при нажатии на ...
This commit is contained in:
@ -1510,7 +1510,7 @@ public class DBMSRecords implements ServletContextAware {
|
|||||||
|
|
||||||
//Filter options for display in the header Excel(XLS) document.
|
//Filter options for display in the header Excel(XLS) document.
|
||||||
/*
|
/*
|
||||||
String filter="<b>"+__("Filter_options",user)+":</b><br>";
|
String filter="<b>"+trt("Filter_options",user)+":</b><br>";
|
||||||
expr = xpath.compile("objects-list/filter/column");
|
expr = xpath.compile("objects-list/filter/column");
|
||||||
exprResult = expr.evaluate(nTypeR, XPathConstants.NODESET);
|
exprResult = expr.evaluate(nTypeR, XPathConstants.NODESET);
|
||||||
nodeList = (NodeList) exprResult;
|
nodeList = (NodeList) exprResult;
|
||||||
@ -1588,8 +1588,8 @@ public class DBMSRecords implements ServletContextAware {
|
|||||||
writer.write(" </head>\n");
|
writer.write(" </head>\n");
|
||||||
writer.write(" <body>\n");
|
writer.write(" <body>\n");
|
||||||
|
|
||||||
writer.write("<b>" + __(conn,"Time_and_date_of_generation",user) + ": </b><i>" + (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date())) + "</i><br>");
|
writer.write("<b>" + trt(conn,"Time_and_date_of_generation",user) + ": </b><i>" + (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date())) + "</i><br>");
|
||||||
writer.write("<b>" + __(conn,"Creator",user) + ": </b>" + uName);
|
writer.write("<b>" + trt(conn,"Creator",user) + ": </b>" + uName);
|
||||||
|
|
||||||
//writer.write(filter);
|
//writer.write(filter);
|
||||||
|
|
||||||
@ -2156,7 +2156,7 @@ public class DBMSRecords implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Перевести слово по идентификатору из базы
|
//Перевести слово по идентификатору из базы
|
||||||
public String __(Connection conn,String key,User user)
|
public String trt(Connection conn,String key,User user)
|
||||||
{
|
{
|
||||||
String result="";
|
String result="";
|
||||||
ResultSet rs=null;
|
ResultSet rs=null;
|
||||||
@ -2178,26 +2178,6 @@ public class DBMSRecords implements ServletContextAware {
|
|||||||
if(rs!=null) try{rs.close();}catch(SQLException ex) {}
|
if(rs!=null) try{rs.close();}catch(SQLException ex) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* закоментил так как теперь цифровые id и всё перенесено в базу
|
|
||||||
if(result.equals(""))
|
|
||||||
{
|
|
||||||
if(m_props==null || !user.language_id.equals(m_props_loc))
|
|
||||||
{
|
|
||||||
m_props_loc = user.language_id;
|
|
||||||
|
|
||||||
InputStream utf8in = getClass().getClassLoader().getResourceAsStream("messages_"+m_props_loc+".properties");
|
|
||||||
Reader reader;
|
|
||||||
try {
|
|
||||||
reader = new InputStreamReader(utf8in, "UTF-8");
|
|
||||||
m_props = new Properties();
|
|
||||||
m_props.load(reader);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
logger.info(ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = m_props.getProperty(key,"");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if(result.equals(""))
|
if(result.equals(""))
|
||||||
{
|
{
|
||||||
result = Tools.replaceAll(key,"_", " ");
|
result = Tools.replaceAll(key,"_", " ");
|
||||||
@ -2209,14 +2189,14 @@ public class DBMSRecords implements ServletContextAware {
|
|||||||
public String getText(Connection conn,String text,User user) {
|
public String getText(Connection conn,String text,User user) {
|
||||||
int pos1 = 0;
|
int pos1 = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
pos1 = text.indexOf("_('", pos1);
|
pos1 = text.indexOf("trt('", pos1);
|
||||||
if (pos1 == -1)
|
if (pos1 == -1)
|
||||||
break;
|
break;
|
||||||
int pos2 = text.indexOf("')", pos1);
|
int pos2 = text.indexOf("')", pos1);
|
||||||
if (pos2 == -1)
|
if (pos2 == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
text = text.substring(0, pos1) + __(conn,text.substring(pos1 + 3, pos2),user) + text.substring(pos2 + 2);
|
text = text.substring(0, pos1) + trt(conn,text.substring(pos1 + 5, pos2),user) + text.substring(pos2 + 2);
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,9 @@ class EdtRec
|
|||||||
let eDiv=document.getElementById('eDiv'+this.uid);
|
let eDiv=document.getElementById('eDiv'+this.uid);
|
||||||
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>'
|
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.caption=caption;
|
||||||
this.win.setCaption(document.createTextNode(caption));
|
if(this.caption!='')
|
||||||
|
this.win.setCaption(this.caption);
|
||||||
this.win.obj=this;
|
this.win.obj=this;
|
||||||
this.win.hide(false);
|
this.win.hide(false);
|
||||||
|
|
||||||
@ -85,20 +86,10 @@ class EdtRec
|
|||||||
//Задать CDATA значение для узла "type->properties->prop" по "n"
|
//Задать CDATA значение для узла "type->properties->prop" по "n"
|
||||||
setPropCdata(name,value)
|
setPropCdata(name,value)
|
||||||
{
|
{
|
||||||
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
|
let node=findNodeOnPath(this.nodeMetadata,"type/properties/prop[@n='"+name+"']");
|
||||||
let nodeProp=nodeProperties.firstChild;
|
if(node!=null) getCdata(node).nodeValue=value;
|
||||||
while(nodeProp!=null)
|
|
||||||
{
|
|
||||||
if(nodeProp.nodeName=="prop")
|
|
||||||
{
|
|
||||||
if(nodeProp.getAttribute("n")==name)
|
|
||||||
{
|
|
||||||
getCdata(nodeProp).nodeValue=value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodeProp=nodeProp.nextSibling;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Задать новое значение GUI полю (не XML, XML выше)
|
//Задать новое значение GUI полю (не XML, XML выше)
|
||||||
setValue(propName,value){
|
setValue(propName,value){
|
||||||
let field=document.getElementById("prop_"+this.uid+"_"+propName);
|
let field=document.getElementById("prop_"+this.uid+"_"+propName);
|
||||||
@ -162,8 +153,8 @@ class EdtRec
|
|||||||
let eTable=document.getElementById('eTable'+this.uid);
|
let eTable=document.getElementById('eTable'+this.uid);
|
||||||
|
|
||||||
let type_name=nodeType.getAttribute("n");
|
let type_name=nodeType.getAttribute("n");
|
||||||
//document.getElementById('caption'+this.uid).appendChild(document.createTextNode(nodeType.getAttribute("d")));
|
if(this.caption === undefined || this.caption=='')
|
||||||
this.win.setCaption(document.createTextNode(nodeType.getAttribute("d")));
|
this.win.setCaption(nodeType.getAttribute("d"));
|
||||||
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
|
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
|
||||||
this.win.setWidth(nodeProperties.getAttribute("width"));
|
this.win.setWidth(nodeProperties.getAttribute("width"));
|
||||||
|
|
||||||
@ -533,7 +524,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){return function(){thiz.SelectObjects(val1,val2);};}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n"));
|
button.onclick=function(thiz,val1,val2){
|
||||||
|
return function(){
|
||||||
|
thiz.SelectObjects(val1,val2);
|
||||||
|
};
|
||||||
|
}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n"));
|
||||||
newCell2.appendChild(button);
|
newCell2.appendChild(button);
|
||||||
|
|
||||||
td2.appendChild( table );
|
td2.appendChild( table );
|
||||||
@ -925,17 +920,23 @@ class EdtRec
|
|||||||
rec.f_State=1;
|
rec.f_State=1;
|
||||||
rec.f_PropName=propname;
|
rec.f_PropName=propname;
|
||||||
rec.f_TypeName=typeName;
|
rec.f_TypeName=typeName;
|
||||||
rec.win.setLeftTop(pageX-250,pageY-10);
|
rec.win.setCenter(); //rec.win.setLeftTop(pageX-250,pageY-10);
|
||||||
rec.win.setParent(this.win);
|
rec.win.setParent(this.win);
|
||||||
|
|
||||||
rec.callData(rec.f_TypeName,"");
|
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>'))
|
/*if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+rec.f_TypeName+'"></type></metadata>'))
|
||||||
{
|
{
|
||||||
rec.showProgressBar();
|
rec.showProgressBar();
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//Call the ShowRecord.html 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)
|
callWindow(nodeProp)
|
||||||
{
|
{
|
||||||
let xmlString="";
|
let xmlString="";
|
||||||
@ -1226,22 +1227,41 @@ class EdtRec
|
|||||||
this.hideProgressBar();
|
this.hideProgressBar();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
//Request data to fill in the field with the button
|
* Request data to fill in the field with the button
|
||||||
setFilterObject(TypeName,prop_id,id)
|
*
|
||||||
|
* @filter - xml text: filter settings
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
setFilterObject(TypeName, prop_id, id, filter)
|
||||||
{
|
{
|
||||||
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");
|
||||||
findNode(node,'#cdata-section').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("filter_"+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='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+TypeName+'" c="'+name+'" pn="'+prop_id+'" fn="'+name+'">';
|
let xml = '';
|
||||||
xml+='<objects-list><filter><column n="id"><![CDATA['+id+']]></column></filter></objects-list>';
|
if(filter!=''){
|
||||||
xml+='</type></metadata>';
|
//Настройка для последующего вызова формы через кнопку
|
||||||
|
xml='<prop n="'+prop_id+'"><type n="' + TypeName + '"><objects-list>'+filter+'</objects-list></type></prop>';
|
||||||
|
applyNodeToNode(CreateXMLDOC(xml).documentElement, node, "n");
|
||||||
|
|
||||||
|
//Для запроса списка значений для выпадающего списка
|
||||||
|
xml = '<?xml version="1.0" encoding="utf-8"?>' +
|
||||||
|
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + prop_id + '" fn="' + name + '">' +
|
||||||
|
'<objects-list>' + filter + '</objects-list>' +
|
||||||
|
'</type></metadata>';
|
||||||
|
}else{
|
||||||
|
xml = '<?xml version="1.0" encoding="utf-8"?>' +
|
||||||
|
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + prop_id + '" fn="' + name + '">' +
|
||||||
|
'<objects-list><filter><column n="id"><![CDATA[' + id + ']]></column></filter></objects-list>' +
|
||||||
|
'</type></metadata>';
|
||||||
|
}
|
||||||
|
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
if(this.request.callServer(ScriptName,xml,true))
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
@ -1442,7 +1462,6 @@ class EdtRec
|
|||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Check the field according to its type
|
//Check the field according to its type
|
||||||
checkData(value,type,maybenull)
|
checkData(value,type,maybenull)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -92,10 +92,10 @@ class SRec
|
|||||||
{
|
{
|
||||||
if ((xmlStr!=null)&&(xmlStr!=""))
|
if ((xmlStr!=null)&&(xmlStr!=""))
|
||||||
{
|
{
|
||||||
xmlDOC=CreateXMLDOC(xmlStr);
|
let xmlDOC=CreateXMLDOC(xmlStr);
|
||||||
//let nPFilter=findFirstNode(xmlDOC,"filter")
|
//let nPFilter=findFirstNode(xmlDOC,"filter")
|
||||||
let nPFilter=findNodeOnPath(xmlDOC.documentElement,"type/objects-list/filter");
|
let nPFilter=findNodeOnPath(xmlDOC.documentElement,"type/objects-list/filter");
|
||||||
nPColumn=nPFilter.firstChild;
|
let nPColumn=nPFilter.firstChild;
|
||||||
while (nPColumn != null)
|
while (nPColumn != null)
|
||||||
{
|
{
|
||||||
if(nPColumn.nodeName=="column")
|
if(nPColumn.nodeName=="column")
|
||||||
@ -156,6 +156,7 @@ class SRec
|
|||||||
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_'+this.uid+'" title="'+trt('Add_record')+'" style="cursor: pointer;"/></td>\
|
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_'+this.uid+'" title="'+trt('Add_record')+'" style="cursor: pointer;"/></td>\
|
||||||
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_'+this.uid+'" title="'+trt('Delete_record')+'" style="cursor: pointer;"/></td>\
|
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_'+this.uid+'" title="'+trt('Delete_record')+'" style="cursor: pointer;"/></td>\
|
||||||
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_'+this.uid+'" title="'+trt('Export_to_Excel')+'" style="cursor: pointer;"/></td>\
|
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_'+this.uid+'" title="'+trt('Export_to_Excel')+'" style="cursor: pointer;"/></td>\
|
||||||
|
<td style="white-space: nowrap; padding-left: 10px;"><label style="display:none;"><input type="checkbox" id="Selection_'+this.uid+'" checked> '+trt('Selection_mode')+'</label></td>\
|
||||||
<td style="width: 99%;"> </td>\
|
<td style="width: 99%;"> </td>\
|
||||||
<td><img src="../resources/metadata/dbms/images/config.png" alt="'+trt('Settings')+'" id="SRec_Cnf_'+this.uid+'" title="'+trt('Settings')+'" style="cursor: pointer;"/></td>\
|
<td><img src="../resources/metadata/dbms/images/config.png" alt="'+trt('Settings')+'" id="SRec_Cnf_'+this.uid+'" title="'+trt('Settings')+'" style="cursor: pointer;"/></td>\
|
||||||
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="'+trt('Refresh')+'" id="SRec_Rfr_'+this.uid+'" title="'+trt('Update')+'" style="cursor: pointer;"/></td></tr>\
|
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="'+trt('Refresh')+'" id="SRec_Rfr_'+this.uid+'" title="'+trt('Update')+'" style="cursor: pointer;"/></td></tr>\
|
||||||
@ -387,29 +388,49 @@ class SRec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//we pass the id to the object filter prop_id - the name of the filter
|
//we pass the id to the object filter column_n - the name of the filter
|
||||||
setFilterObject(TypeName, prop_id, id)
|
setFilterObject(TypeName, column_n, id, filter)
|
||||||
{
|
{
|
||||||
let node=findFirstNodeOnAttribute(this.nodeMetadata,'column','n',prop_id);
|
let node=findFirstNodeOnAttribute(this.nodeMetadata,'column','n',column_n);
|
||||||
if(node!=null)
|
if(node!==null)
|
||||||
{
|
{
|
||||||
let name=node.getAttribute("FieldCaption");
|
let name=node.getAttribute("FieldCaption");
|
||||||
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+'_'+prop_id);
|
let prop=document.getElementById('filter_'+this.uid+'_'+column_n);
|
||||||
if(prop!=null) prop.value=id;
|
if(prop!==null) {
|
||||||
//request comment on the id of the record from the server
|
prop.value = id;
|
||||||
if(this.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+TypeName+'" c="'+name+'" pn="'+prop_id+'" fn="'+name+'"><objects-list><filter><column n="id"><![CDATA['+id+']]></column></filter></objects-list></type></metadata>',true))
|
}
|
||||||
|
//Request a comment on the record id from the server
|
||||||
|
let xml = '';
|
||||||
|
if(filter!=''){
|
||||||
|
//Настройка для последующего вызова
|
||||||
|
xml='<column n="'+column_n+'"><type n="' + TypeName + '"><objects-list>'+filter+'</objects-list></type></column>';
|
||||||
|
applyNodeToNode(CreateXMLDOC(xml).documentElement, node, "n");
|
||||||
|
|
||||||
|
//Настройка для фильтрации списка
|
||||||
|
xml = '<?xml version="1.0" encoding="utf-8"?>' +
|
||||||
|
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + column_n + '" fn="' + name + '">' +
|
||||||
|
'<objects-list>' + filter + '</objects-list>' +
|
||||||
|
'</type></metadata>';
|
||||||
|
}else{
|
||||||
|
xml = '<?xml version="1.0" encoding="utf-8"?>' +
|
||||||
|
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + column_n + '" fn="' + name + '">' +
|
||||||
|
'<objects-list><filter><column n="id"><![CDATA[' + id + ']]></column></filter></objects-list>' +
|
||||||
|
'</type></metadata>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.request.callServer(ScriptName,xml,true))
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
alert2(trt('Alert'),'Filter "'+prop_id+'" not find!');
|
alert2(trt('Alert'),'Filter "'+column_n+'" not find!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//The function to collect data from HTML fields in XML
|
//The function to collect data from HTML fields in to XML
|
||||||
appendFilter()
|
appendFilter()
|
||||||
{
|
{
|
||||||
let nodeType=findFirstNode(this.nodeMetadata, "type");
|
let nodeType=findFirstNode(this.nodeMetadata, "type");
|
||||||
@ -953,6 +974,10 @@ class SRec
|
|||||||
}
|
}
|
||||||
if((count==0)||(h=0)) deleteHTML("idfilter"+this.uid);
|
if((count==0)||(h=0)) deleteHTML("idfilter"+this.uid);
|
||||||
|
|
||||||
|
if(this.f_State>0){
|
||||||
|
document.getElementById('Selection_'+this.uid).parentNode.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
//Columns in which there are links to the array
|
//Columns in which there are links to the array
|
||||||
let pos=0;
|
let pos=0;
|
||||||
let columnNode=this.nodeMetadataObjList.firstChild;
|
let columnNode=this.nodeMetadataObjList.firstChild;
|
||||||
@ -1325,7 +1350,38 @@ class SRec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Call the ShowRecord.html window with the parameters for the filter (not just the object name)
|
//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
|
||||||
|
SelectObjects(typeName,propname)
|
||||||
|
{
|
||||||
|
let rec=new SRec();
|
||||||
|
rec.opener=this;
|
||||||
|
rec.create();
|
||||||
|
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/objects-list/filter/column[@n='"+propname+"']/type");
|
||||||
|
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)
|
||||||
//id - id records from the database
|
//id - id records from the database
|
||||||
//col - Column Number
|
//col - Column Number
|
||||||
callWindow(id,col)
|
callWindow(id,col)
|
||||||
@ -1440,28 +1496,6 @@ class SRec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//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
|
|
||||||
SelectObjects(typeName,propname)
|
|
||||||
{
|
|
||||||
let rec=new SRec();
|
|
||||||
rec.opener=this;
|
|
||||||
rec.create();
|
|
||||||
rec.f_State=1;
|
|
||||||
rec.f_PropName=propname;
|
|
||||||
rec.f_TypeName=typeName;
|
|
||||||
rec.win.setLeftTop(pageX-250,pageY-10);
|
|
||||||
rec.win.setParent(this.win);
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
openPage(page)
|
openPage(page)
|
||||||
{
|
{
|
||||||
open(page);
|
open(page);
|
||||||
@ -1533,19 +1567,36 @@ class SRec
|
|||||||
{
|
{
|
||||||
if(this.f_State=="0") //editing
|
if(this.f_State=="0") //editing
|
||||||
{
|
{
|
||||||
let erec = new EdtRec("");
|
let eRec = new EdtRec("");
|
||||||
erec.win.setParent(this.win);
|
eRec.win.setParent(this.win);
|
||||||
erec.opener=this;
|
eRec.opener=this;
|
||||||
erec.eRecNo(this.nodeMetadata,id);
|
eRec.eRecNo(this.nodeMetadata,id);
|
||||||
|
|
||||||
//e.win.setLeftTop(pageX-10,pageY-10);
|
//e.win.setLeftTop(pageX-10,pageY-10);
|
||||||
}else
|
}else
|
||||||
if(this.f_State=="1") //select one record
|
if(this.f_State=="1") //select one record
|
||||||
{
|
{
|
||||||
|
if(document.getElementById('Selection_'+this.uid).checked) {
|
||||||
|
|
||||||
|
//this.appendFilter(); //To write filter fields in XML
|
||||||
|
let filter="";
|
||||||
|
let nodeType=findFirstNode(this.nodeMetadata, "type");
|
||||||
|
let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter");
|
||||||
|
if (nodeFilter!=null)
|
||||||
|
{
|
||||||
|
filter=getXMLNodeSerialisation(nodeFilter)
|
||||||
|
}
|
||||||
|
|
||||||
//Send the id of the selected record to the parent of the selected record and close the window
|
//Send the id of the selected record to the parent of the selected record and close the window
|
||||||
//alert2(trt('Alert'),"id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName);
|
//alert2(trt('Alert'),"id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName);
|
||||||
this.opener.setFilterObject(this.f_TypeName,this.f_PropName,id);
|
this.opener.setFilterObject(this.f_TypeName, this.f_PropName, id, filter);
|
||||||
this.win.Close();
|
this.win.Close();
|
||||||
|
}else{
|
||||||
|
let eRec = new EdtRec("");
|
||||||
|
eRec.win.setParent(this.win);
|
||||||
|
eRec.opener=this;
|
||||||
|
eRec.eRecNo(this.nodeMetadata,id);
|
||||||
|
//e.win.setLeftTop(pageX-10,pageY-10);
|
||||||
|
}
|
||||||
}else
|
}else
|
||||||
if(this.f_State=="2") //Multiple choice (on the records of ticking TODO is not implemented)
|
if(this.f_State=="2") //Multiple choice (on the records of ticking TODO is not implemented)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -723,7 +723,7 @@ function findNodeOnNum(node,nodename,n)
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//вернуть первый узел заданного типа
|
//Вернуть первый узел заданного типа
|
||||||
function findNodeOnAttribute(node, nodename, Attribute, val)
|
function findNodeOnAttribute(node, nodename, Attribute, val)
|
||||||
{
|
{
|
||||||
if(node==null) return null;
|
if(node==null) return null;
|
||||||
@ -739,19 +739,19 @@ function findNodeOnAttribute(node, nodename,Attribute,val)
|
|||||||
}
|
}
|
||||||
//Вернуть номер узла по атрибуту среди себеподобных (нумерация с 0)
|
//Вернуть номер узла по атрибуту среди себеподобных (нумерация с 0)
|
||||||
function findNumNodeOnAttribute(node, nodename,Attribute,val)
|
function findNumNodeOnAttribute(node, nodename,Attribute,val)
|
||||||
{ if(node==null) return -1;
|
{
|
||||||
|
if(node==null) return -1;
|
||||||
let i=0;
|
let i=0;
|
||||||
let n = node.firstChild;
|
let n = node.firstChild;
|
||||||
while (n != null)
|
while (n != null){
|
||||||
{if(n.nodeName.toLowerCase()==nodename.toLowerCase())
|
if(n.nodeName.toLowerCase()==nodename.toLowerCase()){
|
||||||
{if(n.getAttribute(Attribute)==val) return i;
|
if(n.getAttribute(Attribute)==val) return i;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
n=n.nextSibling;
|
n=n.nextSibling;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//рекурсию не буду использовать, обойдусь массивом вложенности
|
//рекурсию не буду использовать, обойдусь массивом вложенности
|
||||||
function findFirstNode(node, nodename)
|
function findFirstNode(node, nodename)
|
||||||
{
|
{
|
||||||
@ -830,7 +830,11 @@ function findFirstNodeOnAttribute(node, nodename,Attribute,val)
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//поиск узла по пути "type/objects/list/filter/column"
|
/**
|
||||||
|
* Поиск узла по пути "type/objects/list/filter/column" или "Employees/Employee[@id='4']"
|
||||||
|
* @node Node Узел с которого ищется
|
||||||
|
* @path String Путь по котрому ищется
|
||||||
|
*/
|
||||||
function findNodeOnPath(node, path)
|
function findNodeOnPath(node, path)
|
||||||
{
|
{
|
||||||
if(node==null) return null;
|
if(node==null) return null;
|
||||||
@ -838,10 +842,22 @@ function findNodeOnPath(node, path)
|
|||||||
for (let i=0;i<Params.length;i++)
|
for (let i=0;i<Params.length;i++)
|
||||||
{
|
{
|
||||||
if(node==null) return null;
|
if(node==null) return null;
|
||||||
|
let pos1=Params[i].indexOf('[@');
|
||||||
|
if(pos1>=0){
|
||||||
|
let pos2=Params[i].indexOf("='");
|
||||||
|
let pos3=Params[i].indexOf("']");
|
||||||
|
let name=Params[i].substring(0, pos1);
|
||||||
|
let attribute=Params[i].substring(pos1+2, pos2);
|
||||||
|
let val=Params[i].substring(pos2+2, pos3);
|
||||||
|
|
||||||
|
node = findNodeOnAttribute(node, name, attribute, val);
|
||||||
|
}else {
|
||||||
node = findNode(node, Params[i]);
|
node = findNode(node, Params[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//вернёт первую CDATA секцию если её нет то создаст}
|
//вернёт первую CDATA секцию если её нет то создаст}
|
||||||
function getCdata(node,n)
|
function getCdata(node,n)
|
||||||
{
|
{
|
||||||
|
|||||||
5
metadata/include/hint.min.css
vendored
Normal file
5
metadata/include/hint.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -369,10 +369,12 @@ function afterFirst(&$str,$ch)
|
|||||||
{
|
{
|
||||||
return substr($str, strpos($str, $ch)+strlen($ch));
|
return substr($str, strpos($str, $ch)+strlen($ch));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
// Вернёт подстроку если символа нет то всю строку
|
* Вернёт подстроку если символа нет то всю строку
|
||||||
// @param string $str
|
* @param string $str
|
||||||
// @param string $chr
|
* @param string $chr
|
||||||
|
* @return string Подстрока
|
||||||
|
*/
|
||||||
function cutStr(&$str,$chr)
|
function cutStr(&$str,$chr)
|
||||||
{
|
{
|
||||||
$pos = strpos($str, $chr);
|
$pos = strpos($str, $chr);
|
||||||
|
|||||||
Reference in New Issue
Block a user