String combo
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
//Copyright (C) Ivanov I.M. file created in 2008
|
||||
//For find non english chars: [^\x00-\x7F]+
|
||||
|
||||
//Заглушки
|
||||
//Stubs
|
||||
function setPropVal(uid,id,c,p){
|
||||
ERec_mas[uid].setPropVal(id,c,p);
|
||||
}
|
||||
@ -321,15 +321,42 @@ class EdtRec
|
||||
let nList=findNode(nodeProp, "options");
|
||||
if(nList!=null)
|
||||
{
|
||||
nodeProp.field = new TCheckboxListField(nodeProp.getAttribute("n"));
|
||||
let nCheckbox = nList.firstChild;
|
||||
while (nCheckbox!=null) {
|
||||
if(nCheckbox.nodeName=="option") {
|
||||
nodeProp.field.addCheckbox(nCheckbox.getAttribute("n"), nCheckbox.getAttribute("d"));
|
||||
if(nList.getAttribute("selector")=="combo")
|
||||
{
|
||||
let select = document.createElement('select');
|
||||
select.classList.add('DBMS');
|
||||
select.style.cssText="width: 100%; height:22px; line-height: 22px;";
|
||||
select.setAttribute("name",nodeProp.getAttribute("n"));
|
||||
select.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
|
||||
select.onchange = function(thiz,node){ return function()
|
||||
{
|
||||
thiz.onComboObjectChangeHandler(node);
|
||||
};
|
||||
}(this,nodeProp);
|
||||
|
||||
let nCheckbox = nList.firstChild;
|
||||
while (nCheckbox != null) {
|
||||
if (nCheckbox.nodeName == "option") {
|
||||
let option = document.createElement('option');
|
||||
option.setAttribute("value",nCheckbox.getAttribute("n"));
|
||||
option.appendChild(document.createTextNode(nCheckbox.getAttribute("d")));
|
||||
select.appendChild( option );
|
||||
}
|
||||
nCheckbox = nCheckbox.nextSibling;
|
||||
}
|
||||
nCheckbox = nCheckbox.nextSibling;
|
||||
//select.setAttribute("value",value);// does not work because when creating no values in the list
|
||||
newCell1.appendChild(select);
|
||||
}else{
|
||||
nodeProp.field = new TCheckboxListField(nodeProp.getAttribute("n"));
|
||||
let nCheckbox = nList.firstChild;
|
||||
while (nCheckbox != null) {
|
||||
if (nCheckbox.nodeName == "option") {
|
||||
nodeProp.field.addCheckbox(nCheckbox.getAttribute("n"), nCheckbox.getAttribute("d"));
|
||||
}
|
||||
nCheckbox = nCheckbox.nextSibling;
|
||||
}
|
||||
newCell1.appendChild(nodeProp.field.getDiv());
|
||||
}
|
||||
newCell1.appendChild(nodeProp.field.getDiv());
|
||||
}else
|
||||
{
|
||||
let input = document.createElement('input');
|
||||
@ -958,7 +985,7 @@ class EdtRec
|
||||
|
||||
let rec=new SRec();
|
||||
rec.opener=this;
|
||||
rec.create();
|
||||
rec.create(null);
|
||||
rec.f_State=1;
|
||||
rec.f_PropName=nodeProp.getAttribute("n");
|
||||
rec.f_Settings=settings;
|
||||
|
||||
@ -541,7 +541,7 @@ class SRec
|
||||
let td,tr,td1,td2;
|
||||
let nodeFilter=null;
|
||||
let tablefilter=document.getElementById('idfilter'+this.uid);
|
||||
if (tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
|
||||
if (tablefilter==null || tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
|
||||
let nodeType=findFirstNode(node, "type");
|
||||
this.f_pI=nodeType.getAttribute("ins");//access rights
|
||||
this.f_pU=nodeType.getAttribute("upd");
|
||||
@ -1411,7 +1411,7 @@ class SRec
|
||||
}
|
||||
let rec=new SRec();
|
||||
rec.opener=this;
|
||||
rec.create();
|
||||
rec.create(null);
|
||||
//rec.f_State=1; TODO then finish the job
|
||||
//rec.f_PropName=nodeColu.getAttribute("n");
|
||||
rec.f_Settings=settings;
|
||||
@ -1444,7 +1444,7 @@ class SRec
|
||||
//Settings.add(0,xmlString)
|
||||
//wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
|
||||
let rec=new SRec();
|
||||
rec.create();
|
||||
rec.create(null);
|
||||
//rec.f_State=1; not used
|
||||
//rec.f_PropName=propname; not used
|
||||
rec.f_Settings=xmlString;
|
||||
|
||||
@ -302,6 +302,59 @@ function confirm2(title,smallText,fullText,okFunc,cancelFunc)
|
||||
return win;
|
||||
}
|
||||
|
||||
//С поле ввода
|
||||
function prompt2(title,smallText,fieldText,defaultText,okFunc,cancelFunc){
|
||||
let win=new TWin();
|
||||
win.BuildGUI(10,10);
|
||||
win.setCaption(document.createTextNode(title));
|
||||
let html='\n\
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+smallText+'</td>\n\
|
||||
</tr>\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="width: 100%;">'+fieldText+'</td>\n\
|
||||
</tr>\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="width: 100%;"><textarea rows="5" style="width: 100%;" id="text_'+win.uid+'">'+defaultText+'</textarea></td>\n\
|
||||
</tr>\n\
|
||||
<tr style="height: 10px;">\n\
|
||||
<td style="width: 100%;"> </td>\n\
|
||||
<td><button class="button-secondary" id="'+win.uid+'_ok" style="width: 80px;margin:1px;">'+trt('Ok')+'</button></td>\n\
|
||||
<td><button class="button-secondary" id="'+win.uid+'_cancel" style="width: 80px;margin:1px;">'+trt('Cancel')+'</button></td>\n\
|
||||
</tr>\n\
|
||||
</table>';
|
||||
|
||||
win.setContent(html);
|
||||
|
||||
let btnO=document.getElementById(win.uid+'_ok');
|
||||
btnO.focus();
|
||||
if(btnO!=null){
|
||||
btnO.onclick=function(win){
|
||||
return function(){
|
||||
let text=document.getElementById('text_'+win.uid).value;
|
||||
win.Close();
|
||||
if(okFunc!=null) okFunc(text);
|
||||
};
|
||||
}(win,okFunc);
|
||||
}
|
||||
let btnC=document.getElementById(win.uid+'_cancel');
|
||||
if(btnC!=null) {
|
||||
btnC.onclick = function (win) {
|
||||
return function () {
|
||||
win.Close();
|
||||
if(cancelFunc!=null) cancelFunc();
|
||||
};
|
||||
}(win,cancelFunc);
|
||||
}
|
||||
|
||||
win.setSize("350px","200px");
|
||||
win.setCenter();
|
||||
win.shadow=true;
|
||||
win.hide(false);
|
||||
return win;
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавить событие к объекту
|
||||
* @param {object} obj Объект
|
||||
|
||||
Reference in New Issue
Block a user