+ Подробные коменты в не [[]]

This commit is contained in:
2022-08-19 17:12:00 +06:00
parent b0ddda219f
commit d46b696e6d
10 changed files with 279 additions and 96 deletions

View File

@ -191,24 +191,45 @@ function loadContent(url,obj)
}
//Вывести текст поверх окон с кнопочкой OK
function alert2(title,text,okFunc=null)
function alert2(title,smallText,fullText,okFunc=null)
{
if(smallText === undefined || smallText==''){
smallText=fullText;
fullText='';
}
let win=new TWin(true);
win.BuildGUI(10,10);
win.setCaption(document.createTextNode(title));
let html='\n\
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
<tr>\n\
<td colspan="2" style="text-align: center; vertical-align: middle;">'+text+'</td>\n\
<tr id="smallText_'+win.uid+'">\n\
<td colspan="2" style="text-align: center; vertical-align: middle;">'+smallText+'</td>\n\
</tr>\n\
<tr id="fullText_'+win.uid+'" style="display: none;">\n\
<td colspan="2" style="text-align: center; vertical-align: middle;">'+fullText+'</td>\n\
</tr>\n\
<tr style="width: 100%;height: 10px;">\n\
<td>&nbsp;</td>\n\
<td style="width: 80px;"><button class="button-secondary" id="'+win.uid+'_close" style="width: 100%;">'+trt('OK')+'</button></td>\n\
<td>'+(fullText === undefined || fullText == '' ? '' : '<label><input type="checkbox" id="show_'+win.uid+'" name="scales"> '+trt('Full_text')+'</label>')+'&nbsp;</td>\n\
<td style="width: 80px;"><button class="button-secondary" id="close_'+win.uid+'" style="width: 100%;">'+trt('OK')+'</button></td>\n\
</tr>\n\
</table>';
win.setContent(html);
let obj=document.getElementById(win.uid+'_close');
let obj=document.getElementById('show_'+win.uid);
if(obj!=null) obj.onclick=function(win){
return function(){
if(document.getElementById('show_'+win.uid).checked) {
document.getElementById('smallText_' + win.uid).style.display = "none";
document.getElementById('fullText_' + win.uid).style.display = "table-row";
}else{
document.getElementById('smallText_' + win.uid).style.display = "table-row";
document.getElementById('fullText_' + win.uid).style.display = "none";
}
};
}(win);
obj=document.getElementById('close_'+win.uid);
obj.focus();
if(obj!=null) obj.onclick=function(win,okFunc){return function(){ win.Close(); if(okFunc!=null) okFunc(); };}(win,okFunc);
win.setSize("300px","150px");
@ -219,24 +240,41 @@ function alert2(title,text,okFunc=null)
}
//Вывести текст поверх окон с кнопочкой OK
function confirm2(title,text,okFunc,cancelFunc)
function confirm2(title,smallText,fullText,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%;">'+text+'</td>\n\
<tr id="smallText_'+win.uid+'" style="width: 100%;">\n\
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+smallText+'</td>\n\
</tr>\n\
<tr id="fullText_'+win.uid+'" style="width: 100%; display: none;">\n\
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+fullText+'</td>\n\
</tr>\n\
<tr style="height: 10px;">\n\
<td style="width: 100%;">&nbsp;</td>\n\
<td style="width: 100%;">'+(fullText === undefined || fullText == '' ? '' : '<label><input type="checkbox" id="show_'+win.uid+'" name="scales"> '+trt('Full_text')+'</label>')+'&nbsp;</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 obj=document.getElementById('show_'+win.uid);
if(obj!=null) obj.onclick=function(win){
return function(){
if(document.getElementById('show_'+win.uid).checked) {
document.getElementById('smallText_' + win.uid).style.display = "none";
document.getElementById('fullText_' + win.uid).style.display = "table-row";
}else{
document.getElementById('smallText_' + win.uid).style.display = "table-row";
document.getElementById('fullText_' + win.uid).style.display = "none";
}
};
}(win);
let btnO=document.getElementById(win.uid+'_ok');
btnO.focus();
if(btnO!=null){
@ -1293,7 +1331,7 @@ class TWin
let str='';
str+='<table id="TWin_TBL_'+this.tWinId+'" class="DBMSShadow" style="width: 100%; height: 100%; border: 1px solid #000000;">';
str+=' <tr id="TWin_H0_'+this.tWinId+'" style="background: var(--path-grad) repeat-x;"><td></td><td><table 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 ? '' : '<div id="TWin_CL_'+this.tWinId+'" style="display: inline-block; width: 10px; height: 10px; background-image: var(--path-X); cursor:pointer;padding-right: 5px;"></div>')+'</td></tr></table></td><td></td></tr>';
str+=' <tr id="TWin_H0_'+this.tWinId+'" style="background: var(--path-grad) repeat-x;"><td></td><td><table 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 ? '' : '<div id="TWin_CL_'+this.tWinId+'" style="display: inline-block; width: 10px; height: 10px; background-image: var(--path-X); background-repeat: no-repeat; cursor:pointer;padding-right: 5px;"></div>')+'</td></tr></table></td><td></td></tr>';
str+=' <tr>';
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:nw-resize;' : '')+'" id="TWin_TL_'+this.tWinId+'"><img src="'+this.path+'/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>';
@ -1527,9 +1565,9 @@ class TWin
{
if(this.parent!=null)
{
for(var i=0;i<this.parent.childs.length;i++) if(this.parent.childs[i]==this) this.parent.childs[i]=null;
for(let i=0;i<this.parent.childs.length;i++) if(this.parent.childs[i]==this) this.parent.childs[i]=null;
}
if(w!=null)
if(typeof w !== 'undefined' && w!=null)
{
this.parent=w;
w.childs[w.childs.length]=this;