Блокирование закрытия окна tools.js

This commit is contained in:
2020-09-21 12:10:35 +06:00
parent 1190aea0f7
commit df4d14060f
4 changed files with 24 additions and 16 deletions

View File

@ -312,7 +312,7 @@ class EdtRec
if(nList!=null) if(nList!=null)
{ {
nodeProp.field = new TCheckboxListField(nodeProp.getAttribute("n")); nodeProp.field = new TCheckboxListField(nodeProp.getAttribute("n"));
nCheckbox = nList.firstChild; let nCheckbox = nList.firstChild;
while (nCheckbox!=null) { while (nCheckbox!=null) {
if(nCheckbox.nodeName=="option") { if(nCheckbox.nodeName=="option") {
nodeProp.field.addCheckbox(nCheckbox.getAttribute("n"), nCheckbox.getAttribute("d")); nodeProp.field.addCheckbox(nCheckbox.getAttribute("n"), nCheckbox.getAttribute("d"));
@ -1513,7 +1513,7 @@ class EdtRec
}; };
} }
//Поле с галочкой //Поле с галочкой (или галочками)
class TCheckboxListField class TCheckboxListField
{ {
constructor(name) constructor(name)
@ -1529,7 +1529,7 @@ class TCheckboxListField
this.array.push(input); this.array.push(input);
input.setAttribute("type", "checkbox"); input.setAttribute("type", "checkbox");
input.setAttribute("value", nCheckbox.getAttribute("n")); input.setAttribute("value", value);
var label = document.createElement("Label"); var label = document.createElement("Label");
// label.setAttribute("for",id_from_input); // label.setAttribute("for",id_from_input);

View File

@ -90,7 +90,9 @@ class DBMSUser
if(this.win==null || this.win.closed) if(this.win==null || this.win.closed)
{ {
this.win=new TWin(true); this.win=new TWin(true);
this.win.disableClosing=true;
this.win.BuildGUI(10,10); this.win.BuildGUI(10,10);
deleteHTML('TWin_CL_'+this.win.uid); //Удаляю кнопку закрыть
this.win.setCaption(trt('Authorization')); this.win.setCaption(trt('Authorization'));
this.win.setSize("350px","200px"); this.win.setSize("350px","200px");

View File

@ -586,10 +586,10 @@ class SRec
let input = document.createElement('input'); let input = document.createElement('input');
input.style.cssText="width: 100%;"; input.style.cssText="width: 100%;";
input.setAttribute("type","text"); input.setAttribute("type","text");
input.onkeydown=function(event){ /*input.onkeydown=function(event){
events = event || window.event; events = event || window.event;
if(events.keyCode==13) events.keyCode=9; if(events.keyCode==13) events.keyCode=9;
}; };*/
input.setAttribute("name",columnNode.getAttribute("n")); input.setAttribute("name",columnNode.getAttribute("n"));
if(columnNode.getAttribute("size")!=null) if(columnNode.getAttribute("size")!=null)
input.setAttribute("maxlength",columnNode.getAttribute("size"),0); input.setAttribute("maxlength",columnNode.getAttribute("size"),0);
@ -632,10 +632,10 @@ class SRec
input = document.createElement('input'); input = document.createElement('input');
input.style.cssText="width: 100%;"; input.style.cssText="width: 100%;";
input.setAttribute("type","text"); input.setAttribute("type","text");
input.onkeydown=function(event){ /*input.onkeydown=function(event){
events = event || window.event; events = event || window.event;
if(events.keyCode==13) events.keyCode=9; if(events.keyCode==13) events.keyCode=9;
}; };*/
input.setAttribute("name",columnNode.getAttribute("n")); input.setAttribute("name",columnNode.getAttribute("n"));
if(columnNode.getAttribute("size")!=null) if(columnNode.getAttribute("size")!=null)
input.setAttribute("maxlength",columnNode.getAttribute("size"),0); input.setAttribute("maxlength",columnNode.getAttribute("size"),0);

View File

@ -901,13 +901,15 @@ function delChild(obj)
* @returns {undefined} * @returns {undefined}
*/ */
function applyNodeToNode(first, second, name) function applyNodeToNode(first, second, name)
{ {
if(first===null || second===null || name ===null) return; if(first===null || second===null || name ===null){
console.error("first="+first+" second="+second+" name="+name);
return;
}
//Если есть совпадающие узлы то передаём в рекурсию если нет то просто копируем //Если есть совпадающие узлы то передаём в рекурсию если нет то просто копируем
var fn=first.firstChild; var fn=first.firstChild;
while (fn !== null) while (fn !== null)
{ {
//alert(name+" "+fn.getAttribute("n"));
var sn=null; var sn=null;
if(fn.nodeName!=="#text" && fn.nodeName!=="#cdata-section" && fn.nodeName!=="#comment"){ //потому что для этих getAttribute вызывает ошибку if(fn.nodeName!=="#text" && fn.nodeName!=="#cdata-section" && fn.nodeName!=="#comment"){ //потому что для этих getAttribute вызывает ошибку
sn=findNodeOnAttribute(second,fn.nodeName,name,fn.getAttribute(name)); sn=findNodeOnAttribute(second,fn.nodeName,name,fn.getAttribute(name));
@ -1266,7 +1268,7 @@ class TWin
let str=''; let str='';
str+='<table id="TWin_TBL_'+this.tWinId+'" class="shadow" border="0px" cellspacing="0" cellpadding="0" style="width: 100%; height: 100%; border: 1px solid #000000;">'; str+='<table id="TWin_TBL_'+this.tWinId+'" class="shadow" border="0px" cellspacing="0" cellpadding="0" style="width: 100%; height: 100%; border: 1px solid #000000;">';
str+=' <tr id="TWin_H0_'+this.tWinId+'" style="background: url(../resources/metadata/dbms/form/'+imgB+') repeat-x;"><td></td><td><table cellspacing="0" cellpadding="0" style="width: 100%; height: 29px;"><tr><td id="TWin_Ca_'+this.tWinId+'" style="vertical-align: middle; cursor: move; font-weight: bold; white-space: nowrap;"></td><td style="width: 10px; vertical-align: middle;"><img src="../resources/metadata/dbms/form/'+imgX+'" id="TWin_CL_'+this.tWinId+'" style="cursor:pointer;padding-right: 5px;"></td></tr></table></td><td></td></tr>'; str+=' <tr id="TWin_H0_'+this.tWinId+'" style="background: url(../resources/metadata/dbms/form/'+imgB+') repeat-x;"><td></td><td><table cellspacing="0" cellpadding="0" style="width: 100%; height: 29px;"><tr><td id="TWin_Ca_'+this.tWinId+'" style="vertical-align: middle; cursor: move; font-weight: bold; white-space: nowrap;"></td><td style="width: 10px; vertical-align: middle;">'+(this.disableClosing ? '' : '<img src="../resources/metadata/dbms/form/'+imgX+'" id="TWin_CL_'+this.tWinId+'" style="cursor:pointer;padding-right: 5px;">')+'</td></tr></table></td><td></td></tr>';
str+=' <tr>'; str+=' <tr>';
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:nw-resize;' : '')+'" id="TWin_TL_'+this.tWinId+'"><img src="../resources/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>'; str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:nw-resize;' : '')+'" id="TWin_TL_'+this.tWinId+'"><img src="../resources/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>';
str+=' <td style="vertical-align:top;height: 5px;'+(!this.dialog ? ' cursor:n-resize;' : '')+'" id="TWin_T_'+this.tWinId+'"></td>'; str+=' <td style="vertical-align:top;height: 5px;'+(!this.dialog ? ' cursor:n-resize;' : '')+'" id="TWin_T_'+this.tWinId+'"></td>';
@ -1303,8 +1305,12 @@ class TWin
this.setSel(); this.setSel();
this.div.onmousedown=function(thiz){ return function(e){ thiz.setSel(); } }(this); this.div.onmousedown=function(thiz){ return function(e){ thiz.setSel(); } }(this);
//Кнопка закрыть окно
document.getElementById('TWin_CL_'+this.tWinId).onclick=function(win){return function(){ win.Close(); };}(this); //Закрыть окно let obj=document.getElementById('TWin_CL_'+this.tWinId);
if(obj!=null){
//obj.onclick=function(win){return function(){ win.Close(); };}(this);
obj.onclick=(function(){ this.Close(); }).bind(this);
}
if(!this.dialog) if(!this.dialog)
{ {
@ -1333,7 +1339,7 @@ class TWin
setCaption(val) setCaption(val)
{ {
var obj=document.getElementById('TWin_Ca_'+this.tWinId); let obj=document.getElementById('TWin_Ca_'+this.tWinId);
if (typeof val === 'string' || val instanceof String) if (typeof val === 'string' || val instanceof String)
obj.innerHTML=val; obj.innerHTML=val;
else else
@ -1475,7 +1481,7 @@ class TWin
//Переместить окно на передний план (Обычно при щелчке на нём) //Переместить окно на передний план (Обычно при щелчке на нём)
setWinZ(s) setWinZ(s)
{ {
var i; let i;
this.setZ(Wins.getMaxZ()+2); //+2 это для тени this.setZ(Wins.getMaxZ()+2); //+2 это для тени
if(s && this.parent!=null) //Переносим текущий элемент в 0й элемент массива детей родительского if(s && this.parent!=null) //Переносим текущий элемент в 0й элемент массива детей родительского
{ {
@ -1483,7 +1489,7 @@ class TWin
for(i=1;i<this.parent.childs.length;i++) for(i=1;i<this.parent.childs.length;i++)
{ {
if(tmp==this) break; if(tmp==this) break;
var t=this.parent.childs[i]; let t=this.parent.childs[i];
this.parent.childs[i]=tmp; this.parent.childs[i]=tmp;
tmp=t; tmp=t;
} }