diff --git a/metadata/dbms/editrecord.js b/metadata/dbms/editrecord.js index 29a2cd0..d8f2e69 100644 --- a/metadata/dbms/editrecord.js +++ b/metadata/dbms/editrecord.js @@ -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; diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js index 79870fa..2b25d64 100644 --- a/metadata/dbms/showrecord.js +++ b/metadata/dbms/showrecord.js @@ -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; diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js index 6a13f4c..c596aca 100644 --- a/metadata/dbms/tools.js +++ b/metadata/dbms/tools.js @@ -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\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ +
'+smallText+'
'+fieldText+'
 
'; + + 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 Объект