diff --git a/metadata/dbms/editrecord.js b/metadata/dbms/editrecord.js index f8ad238..0af797a 100644 --- a/metadata/dbms/editrecord.js +++ b/metadata/dbms/editrecord.js @@ -763,7 +763,7 @@ class EdtRec td.setAttribute("align","right"); button = document.createElement('input'); button.setAttribute("type","button"); - button.style.cssText="margin:0px;margin-right:1px;padding:0px;"; + button.style.cssText="margin:0px;margin-right:1px;"; button.setAttribute("value",_('Apply')); button.onclick=function(thiz){ return function(){ @@ -774,7 +774,7 @@ class EdtRec button = document.createElement('input'); //Button cancel button.setAttribute("type","button"); - button.style.cssText="margin:0px;padding:0px;"; + button.style.cssText="margin:0px;"; button.setAttribute("value",_('Cancel')); //button.onclick=function f_exit(this) { alert(this.win.div); } button.onclick=function(thiz){ return function(){thiz.win.Close();};}(this); diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js index a20a9a9..3ded532 100644 --- a/metadata/dbms/tools.js +++ b/metadata/dbms/tools.js @@ -862,15 +862,25 @@ function replaseTextInCDATA(node,oldStr,newStr) } //Wrapper for XMLHttpRequest -function TRequest(listener) +class TRequest { - this.callServer=function(url,xmlString) + constructor(listener) + { + if(listener.applyReq==null) alert('An object can not be found the function: "applyReq()"!'); + //if(listener.name==null) alert('An object can not be found the propenty: "name"!'); незачем + this.winObj=listener; + //private + this.m_seq=0; + this.seq=-1; + } + + callServer(url,xmlString) { var call=new myXMLHttpRequest(this); return call.callServer(url,xmlString); - }; + } - this.processReqChange=function(xmlHttpRequest,url,xmlString) + processReqChange(xmlHttpRequest,url,xmlString) { //if (typeof(xmlHttpRequest.readyState)=='undefined' || xmlHttpRequest.readyState == 4) //{ @@ -910,25 +920,26 @@ function TRequest(listener) } //} return null; - }; - - if(listener.applyReq==null) alert('An object can not be found the function: "applyReq()"!'); - //if(listener.name==null) alert('An object can not be found the propenty: "name"!'); незачем - this.winObj=listener; - //private - this.m_seq=0; - this.seq=-1; + } }; -//Session=new TSession(); //Global object (закоментил потому что в глобальности нет необходимости каждый раз должен быть новый) /** Класс асинхронных запросов к серверу */ -function myXMLHttpRequest(obj) +class myXMLHttpRequest { + constructor(obj) + { + this.url=null; + this.xmlString=null; + this.name="myXMLHttpRequest"; + this.obj=obj; + if(obj.processReqChange==null) alert('Нет функции "processReqChange"'); + this.xmlHttpRequest=createRequestObject(); + } /** * Функция возвращяет ссылку на анонимную функцию */ - this.LocCallback=function(thiz) + LocCallback(thiz) { return function() { @@ -939,10 +950,10 @@ function myXMLHttpRequest(obj) thiz.obj.processReqChange(thiz.xmlHttpRequest,thiz.url,thiz.xmlString);//вызываем метод переданного объекта } }; - }; + } /** Запросить данные постом */ - this.callServer=function(url,xmlString) + callServer(url,xmlString) { this.url=url; this.xmlString=xmlString; @@ -955,10 +966,10 @@ function myXMLHttpRequest(obj) this.xmlHttpRequest.send(xmlString); return true; - }; + } /** Запросить данные гетом */ - this.GETFromServer=function(url,xmlString) + GETFromServer(url,xmlString) { this.url=url; this.xmlString=xmlString; @@ -967,26 +978,49 @@ function myXMLHttpRequest(obj) this.xmlHttpRequest.open("GET", url, true); this.xmlHttpRequest.setRequestHeader("Content-Type", "text/xml"); this.xmlHttpRequest.send(xmlString); - }; - - this.url=null; - this.xmlString=null; - this.name="myXMLHttpRequest"; - this.obj=obj; - if(obj.processReqChange==null) alert('Нет функции "processReqChange"'); - this.xmlHttpRequest=createRequestObject(); + } } //Класс окна -function TWin(dialog) +class TWin { - this.addResizeListener=function(func) + constructor(dialog) + { + this.dialog=dialog; //Показывать окно как диалог (без возможности изменения размеров) + + this.closed=false; //Закрыли (те. удалили из родителя и детей и из DOM) + this.onClose=null; //слушатель закрытия окна + this.childs=new Array(); //Подчинёные окна + this.parent=null; //родительское окно + this.name="TWin"; + this.tWinId=0; + this.dx=0; + this.dy=0; + this.sel=false; + this.obj=null; //user data + + this.div=document.createElement('div'); //Окно + this.divsh=document.createElement('div'); //Тень для модального окна + this.tbl=null; + this.h0=null; + this.ca=null; + this.co=null; + this.shadow = false; //Показывать ли тень вокруг окошка + this.uid=getUID(); //Уникальныйидентификатор + + this.pBarCnt=0; //Прогресс бар + this.pBarDiv=null; //Прогресс бар + + var fnResizeListener=null; + } + + addResizeListener(func) { this.fnResizeListener=func; this.fnResizeListener(); - }; + } - this.onResize=function(x,y) + onResize(x,y) { var win=this; return function(e){ @@ -1029,9 +1063,9 @@ function TWin(dialog) }; return false; }; - }; + } - this.Close=function() //Закрыть и удалить окно из родителя и менеджера + Close() //Закрыть и удалить окно из родителя и менеджера { this.hide(true); this.setParent(null); @@ -1050,7 +1084,7 @@ function TWin(dialog) }; //Типа конструктор создать окно с заданой позицией - this.TWin = function(x,y) + TWin(x,y) { this.tWinId=Wins.add(this); /* @@ -1170,24 +1204,24 @@ function TWin(dialog) //this.setMove(document.getElementById('TWin_H3_'+this.tWinId)); this.setLeftTop(x,y); - }; + } - this.getCaption = function() + getCaption() { return document.getElementById('TWin_Ca_'+this.tWinId); - }; + } - this.setCaption = function(val) + setCaption(val) { var obj=document.getElementById('TWin_Ca_'+this.tWinId); if (typeof val === 'string' || val instanceof String) obj.innerHTML=val; else obj.appendChild(val); - }; + } //Присвоить содержимое в виде строки - this.setContent = function(html) + setContent(html) { var obj=document.getElementById('TWin_Co_'+this.tWinId); if(obj!=null) @@ -1196,9 +1230,9 @@ function TWin(dialog) if(this.tbl.offsetHeight>this.div.offsetHeight) this.div.style.height=this.tbl.offsetHeight+"px"; if(this.tbl.offsetWidth>this.div.offsetWidth) this.div.style.width=this.tbl.offsetWidth+"px"; } - }; + } //Выбрать (активизировать) окно - this.setSel = function() + setSel() { for(var i=0;ithis.div.offsetWidth) this.div.style.width=this.tbl.offsetWidth+"px" }; - this.getWidth=function(){return parseInt(this.tbl.offsetWidth);}; + getWidth(){return parseInt(this.tbl.offsetWidth);}; - this.setHeight=function(h) + setHeight(h) { if(h==null || h=='') return; h=''+h; @@ -1278,14 +1312,15 @@ function TWin(dialog) }; //Подстроить размер окна по содержимому - /*this.adjustHeight=function() + /*adjustHeight() { }*/ //Подгрузить содержимое окна из указаного места - //json - объект который передастца в виде JSON строки - this.load=function(url,json,func) + //json - объект который передастца в виде JSON строки по URL + //func - функция которая выполниться после загрузки данных в форму + load(url,json,func) { this.showProgressBar(); var r=createRequestObject(); @@ -1300,15 +1335,20 @@ function TWin(dialog) //Для подстройки формы под новый размер, а то showProgressBar не по размеру было thiz.div.style.width=thiz.tbl.offsetWidth+"px" thiz.div.style.height=thiz.tbl.offsetHeight+"px"; + + thiz.setCenter(); } } }(r,this.co,this,func) r.open( "POST", url, true ); - r.send(JSON.stringify(json)); + if(json!=null) + r.send(JSON.stringify(json)); + else + r.send(); }; //Переместить окно на передний план (Обычно при щелчке на нём) - this.setWinZ=function(s) + setWinZ(s) { var i; this.setZ(Wins.getMaxZ()+2); //+2 это для тени @@ -1325,8 +1365,8 @@ function TWin(dialog) this.parent.childs[0]=tmp; } for(i=this.childs.length;i>0;i--) if(this.childs[i-1]!=null) this.childs[i-1].setWinZ(false) //Забыл зачем это делаю - }; - this.setParent=function(w) + } + setParent(w) { if(this.parent!=null) { @@ -1337,8 +1377,8 @@ function TWin(dialog) this.parent=w; w.childs[w.childs.length]=this; } - }; - this.hide=function(val) + } + hide(val) { if(val) { this.div.style.display='none'; @@ -1348,10 +1388,10 @@ function TWin(dialog) this.div.style.display='inline'; if(this.shadow) this.divsh.style.display='block'; } - }; + } //Показать прогрес бар - this.showProgressBar=function() + showProgressBar() { this.pBarCnt++; if(this.pBarDiv==null) @@ -1366,10 +1406,10 @@ function TWin(dialog) //var eDiv=document.getElementById('eDiv'+this.uid); this.div.appendChild(this.pBarDiv); } - }; + } //Спрятать прогрес бар - this.hideProgressBar=function() + hideProgressBar() { this.pBarCnt--; if(this.pBarCnt<=0) @@ -1378,71 +1418,50 @@ function TWin(dialog) this.pBarCnt=0; this.pBarDiv=null; } - }; + } - this.dialog=dialog; //Показывать окно как диалог (без возможности изменения размеров) - - this.closed=false; //Закрыли (те. удалили из родителя и детей и из DOM) - this.onClose=null; //слушатель закрытия окна - this.childs=new Array(); //Подчинёные окна - this.parent=null; //родительское окно - this.name="TWin"; - this.tWinId=0; - this.dx=0; - this.dy=0; - this.sel=false; - this.obj=null; //user data - - this.div=document.createElement('div'); //Окно - this.divsh=document.createElement('div'); //Тень для модального окна - this.tbl=null; - this.h0=null; - this.ca=null; - this.co=null; - this.shadow = false; //Показывать ли тень вокруг окошка - this.uid=getUID(); //Уникальныйидентификатор - - this.pBarCnt=0; //Прогресс бар - this.pBarDiv=null; //Прогресс бар - - - var fnResizeListener=null; } -function TWins() +class TWins { - this.add = function(win) //Добавить окно в список + constructor() + { + this.mas = new Array(); + } + add(win) //Добавить окно в список { this.mas.push(win); return this.mas.length-1; }; - this.getMaxZ = function() //Получить максимальный Z индекс + getMaxZ() //Получить максимальный Z индекс { var z=100; //По умолчанию for(var i=0;iz) z=this.mas[i].getZ(); return z; }; - this.getSel = function() //Получить выделенное окно + getSel() //Получить выделенное окно { for(var i=0;i