В xyz
This commit is contained in:
@ -56,6 +56,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -105,10 +109,13 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
//Документация по @RequestBody http://javastudy.ru/spring-mvc/json-xml/ application/xml
|
||||
@RequestMapping(value = "/monitoring/records.php",method = {RequestMethod.POST,RequestMethod.GET},produces = "text/plain; charset=utf-8")
|
||||
@RequestMapping(value = "/api/dbms/records.xyz",method = {RequestMethod.POST,RequestMethod.GET}) //,produces = "text/plain; charset=utf-8"
|
||||
@ResponseBody
|
||||
public Object ajaxTamer(@ModelAttribute User user,@RequestBody(required = false) byte[] reqData,@RequestParam(required=false,name="lng") String language_id) {
|
||||
|
||||
public ResponseEntity<String> ajaxTamer(@ModelAttribute User user, @RequestBody(required = false) byte[] reqData, @RequestParam(required=false,name="lng") String language_id) {
|
||||
final HttpHeaders httpHeaders= new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
|
||||
if(language_id!=null && !language_id.equals(""))
|
||||
user.language_id=language_id;
|
||||
logger.info("user.id="+user.id+" user.name="+user.name+" user.language_id="+user.language_id+" user.country_id="+user.country_id);
|
||||
@ -116,7 +123,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
boolean error=false;
|
||||
String result=sendError(1,"Request not processed!");
|
||||
if(reqData==null)
|
||||
return result;
|
||||
return new ResponseEntity<String>(result, httpHeaders, HttpStatus.OK);
|
||||
|
||||
//response.setCharacterEncoding("UTF-8");
|
||||
|
||||
@ -198,7 +205,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
} catch (Exception ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//return "<metadata fn=\"-1\"><![CDATA[Parsing request error!]]></metadata>";
|
||||
return sendError(1,"Parsing request error!");
|
||||
return new ResponseEntity<String>(sendError(1,"Parsing request error!"), httpHeaders, HttpStatus.OK);
|
||||
}
|
||||
|
||||
if (doc != null) {
|
||||
@ -427,6 +434,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
result=getText(conn,xml,user);
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
|
||||
} else if (fn != null && fn.equals("1")) {
|
||||
String typename = "";
|
||||
@ -511,7 +519,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
sql_query = Tools.replaceAll(sql_query,"${" + vn + "}", getSQLValue(vt, val));
|
||||
|
||||
}
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
logger.info("sql_query22 = " + sql_query);
|
||||
|
||||
@ -528,7 +537,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
String xmlstring = "<metadata fn=\"1\"><type n=\"" + typename + "\" id=\"" + obj_id + "\"></type></metadata>";
|
||||
|
||||
result=xmlstring;
|
||||
logger.info("xmlstring = " + xmlstring);
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
stt.close();
|
||||
rs.close();
|
||||
@ -624,7 +634,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
sql_query=Tools.replaceAll(sql_query,"${" + vn + "}", getSQLValue(vt, val));
|
||||
}
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
logger.info("sql_query = " + sql_query);
|
||||
|
||||
@ -642,7 +653,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
String xmlstring = "<metadata fn=\"2\"><type n=\"" + typename + "\" id=\"" + obj_id + "\"></type></metadata>";
|
||||
|
||||
result=xmlstring;
|
||||
logger.info("xmlstring = " + xmlstring);
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
@ -715,7 +727,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
} */
|
||||
|
||||
sql_query = Tools.replaceAll(sql_query,"${id}", getSQLValue("string", obj_id)); //string а не i4 так как некоторые таблицы с uuid
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
//logger.info("sql_query = " + sql_query);
|
||||
|
||||
@ -732,6 +745,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
String xmlstring = "<metadata fn=\"3\"><type n=\"" + typename + "\" id=\"" + obj_id + "\"></type></metadata>";
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
@ -830,7 +844,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
nextnode = nextnode.getNextSibling();
|
||||
}
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
//logger.info("sql_query = " + sql_query);
|
||||
|
||||
@ -930,8 +945,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
xmlstring += "</type></metadata>\n";
|
||||
result=xmlstring;*/
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("errorCode",0);
|
||||
json.put("errorMessage","");
|
||||
json.put("error_code",0);
|
||||
json.put("error_message","");
|
||||
json.put("fn",fn);
|
||||
json.put("n",typename);
|
||||
json.put("pc",pagecount);
|
||||
@ -1010,6 +1025,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
String sql_query = "";
|
||||
String typename = "";
|
||||
String idname = "";
|
||||
String id = "";
|
||||
|
||||
Node nTypeR = null;
|
||||
if (doc != null) {
|
||||
@ -1024,7 +1040,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
if (nodeList.getLength() > 0) {
|
||||
nTypeR = nodeList.item(0);
|
||||
typename = "" + nTypeR.getAttributes().getNamedItem("n").getNodeValue();
|
||||
idname = "" + nTypeR.getAttributes().getNamedItem("id").getNodeValue();
|
||||
idname = "" + nTypeR.getAttributes().getNamedItem("ObjectID").getNodeValue();
|
||||
id = "" + nTypeR.getAttributes().getNamedItem("id").getNodeValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,8 +1061,9 @@ public class DBMSRecords implements ServletContextAware {
|
||||
logger.info(ex.getMessage());
|
||||
}
|
||||
|
||||
sql_query = Tools.replaceAll(sql_query,"${id}", getSQLValue("string", idname)); //Set current record id into sql query.
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id into sql query.
|
||||
sql_query = Tools.replaceAll(sql_query,"${"+idname+"}", getSQLValue("string", id));
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
//logger.info("sql_query = " + sql_query);
|
||||
|
||||
@ -1058,7 +1076,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
if (rs != null) {
|
||||
//Выбираем данные и строим XML для отправки клиенту
|
||||
String xmlstring = "";
|
||||
xmlstring += "<metadata fn=\"" + fn + "\"><type n=\"" + typename + "\" id=\"" + idname + "\"><properties>\n";
|
||||
xmlstring += "<metadata fn=\"" + fn + "\"><type n=\"" + typename + "\" id=\"" + id + "\"><properties>\n";
|
||||
NodeList nodeList=null;
|
||||
try {
|
||||
nodeList = (NodeList) xpath.compile("properties/prop").evaluate(nTypeS, XPathConstants.NODESET);
|
||||
@ -1085,6 +1103,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
xmlstring += "</properties></type></metadata>\n";
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
@ -1193,7 +1212,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
nextnode = nextnode.getNextSibling();
|
||||
}
|
||||
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
//logger.info("sql_query = " + sql_query);
|
||||
|
||||
@ -1220,6 +1240,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
xmlstring += "</type></metadata>\n";
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
@ -1566,7 +1587,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
result=xmlstring;
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
|
||||
} else if (fn != null && fn.equals("8")) {
|
||||
//Select information about the current user
|
||||
@ -1695,7 +1716,8 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
nextnode = nextnode.getNextSibling();
|
||||
}
|
||||
sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id); //Set current user id in sql query.
|
||||
if(user.id==null) sql_query = Tools.replaceAll(sql_query,"${_user_id}", "null");
|
||||
else sql_query = Tools.replaceAll(sql_query,"${_user_id}", (String) user.id);
|
||||
|
||||
//logger.info("sql_query2 = " + sql_query);
|
||||
|
||||
@ -1890,14 +1912,10 @@ public class DBMSRecords implements ServletContextAware {
|
||||
result=sendError(1,"Unknown function \"" + fn + "\" !");
|
||||
error=true;
|
||||
}
|
||||
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try { if(conn!=null) conn.close(); } catch (SQLException e) { throw new RuntimeException(e); }
|
||||
//return body content
|
||||
return result;
|
||||
return new ResponseEntity<String>(result, httpHeaders, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2064,7 +2082,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
}
|
||||
|
||||
if(conn!=null){try{conn.close();}catch(SQLException ex){}}
|
||||
try { if(conn!=null) conn.close(); } catch (SQLException e) { throw new RuntimeException(e); }
|
||||
|
||||
if(file!=null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
|
||||
@ -8,11 +8,10 @@ function setPropVal(uid,id,c,p){
|
||||
|
||||
var ERec_mas = new Array(); //List of all ERec objects (TODO then you better come up with something).
|
||||
|
||||
class EdtRec extends TWin
|
||||
class EdtRec
|
||||
{
|
||||
constructor(caption,dialog,path)
|
||||
constructor(caption)
|
||||
{
|
||||
super(dialog,path);
|
||||
this.uid=getUID();
|
||||
this.record_id=null;
|
||||
|
||||
@ -20,7 +19,6 @@ class EdtRec extends TWin
|
||||
this.win.BuildGUI(pageX-10,pageY-10);
|
||||
this.win.setSize("500px","150px");
|
||||
this.win.setContent('<div id="eDiv'+this.uid+'" style="width: 100%; /*height: 100%;*/ position: relative;"></div>');
|
||||
this.win.obj=this;
|
||||
|
||||
let eDiv=document.getElementById('eDiv'+this.uid);
|
||||
eDiv.innerHTML = '<table style="width:100%;height:100%"><tr><td style="vertical-align:middle;background-color:#F1F1F1"><center><IMG src="../resources/metadata/dbms/images/loading.gif"></center></td></tr></table>'
|
||||
@ -28,6 +26,7 @@ class EdtRec extends TWin
|
||||
this.caption=caption;
|
||||
if(this.caption!='')
|
||||
this.win.setCaption(this.caption);
|
||||
this.win.obj=this;
|
||||
this.win.hide(false);
|
||||
|
||||
this.name="name"+this.uid;
|
||||
@ -831,7 +830,7 @@ class EdtRec extends TWin
|
||||
button.setAttribute("value",trt('Apply'));
|
||||
button.onclick=()=>this.sendData();
|
||||
td.appendChild( button );
|
||||
|
||||
|
||||
button = document.createElement('input'); //Button cancel
|
||||
button.classList.add('button-secondary');
|
||||
button.setAttribute("type","button");
|
||||
@ -1038,7 +1037,7 @@ class EdtRec extends TWin
|
||||
}else
|
||||
{
|
||||
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'"></type></metadata>';
|
||||
if(this.request.callServer(ScriptName,xml,true));
|
||||
if(this.request.callServer(ScriptName,xml,true))
|
||||
{
|
||||
this.showProgressBar();
|
||||
}
|
||||
@ -1204,8 +1203,8 @@ class EdtRec extends TWin
|
||||
{
|
||||
this.hideProgressBar();
|
||||
|
||||
if(node.errorCode>0) {
|
||||
alert2(trt('Alert'), node.errorMessage);
|
||||
if(node.error_code>0) {
|
||||
alert2(trt('Alert'), node.error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -20,8 +20,8 @@ class DBMSUser
|
||||
{
|
||||
this.showShadow(false);
|
||||
|
||||
if(node.errorCode>0) {
|
||||
alert2(trt('Alert'), node.errorMessage);
|
||||
if(node.error_code>0) {
|
||||
alert2(trt('Alert'), node.error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,28 +98,28 @@ class DBMSUser
|
||||
|
||||
this.win.setSize("350px","184px");
|
||||
|
||||
var str='<div style="width: 100%; height: 100%; padding: 3px; text-align: left;">\n\
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
|
||||
<tbody>\n\
|
||||
<tr><td>\n\
|
||||
<table style="width: 100%; height: 100%;">\n\
|
||||
<tr>\n\
|
||||
<td style="padding: 2px; width: 30%; white-space: nowrap"><b>'+trt('Login')+' (E-mail):</b></td>\n\
|
||||
<td style="padding: 2px;"><input type="text" maxlength="50" style="width: 100%; padding: 2px; display: inline;" id="tcLogin'+this.uid+'" name="login"><br></td>\n\
|
||||
</tr>\n\
|
||||
<tr>\n\
|
||||
<td style="padding: 2px;"><b>Password:</b></td>\n\
|
||||
<td style="padding: 2px;"><input type="password" maxlength="33" style="width: 100%; padding: 2px; display: inline;" id="tcPassword'+this.uid+'" name="password"><br></td>\n\
|
||||
</tr>\n\
|
||||
<tr>\n\
|
||||
<td style="padding: 2px;" colspan="2"><table style="width: 100%;"><tr><td><label for="save0" style="white-space: nowrap;"><input id="save_'+this.uid+'" type="checkbox" style="display: inline;" checked/> Remember (<a href="#" onclick="g_user.showRestoreForm();">Forgot your password?</a>)</label></td></tr></table></td>\n\
|
||||
</tr>\n\
|
||||
<tr><td colspan="2" style="text-align: right;"><input class="button-secondary" id="TLogin_E'+this.uid+'" type="button" style="display: inline;" value="'+trt('Log_in')+'"></td></tr>\n\
|
||||
</table>\n\
|
||||
</td></tr>\n\
|
||||
</tbody>\n\
|
||||
</table>\n\
|
||||
</div>';
|
||||
let str=`<div style="width: 100%; height: 100%; padding: 3px; text-align: left;">
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
|
||||
<tbody>
|
||||
<tr><td>
|
||||
<table style="width: 100%; height: 100%;">
|
||||
<tr>
|
||||
<td style="padding: 2px; width: 30%; white-space: nowrap"><b>`+trt('Login')+` (E-mail):</b></td>
|
||||
<td style="padding: 2px;"><input type="text" maxlength="50" style="width: 100%; padding: 2px; display: inline;" id="tcLogin`+this.uid+`" name="login"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 2px;"><b>Password:</b></td>
|
||||
<td style="padding: 2px;"><input type="password" maxlength="33" style="width: 100%; padding: 2px; display: inline;" id="tcPassword`+this.uid+`" name="password"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 2px;" colspan="2"><table style="width: 100%;"><tr><td><label for="save0" style="white-space: nowrap;"><input id="save_`+this.uid+`" type="checkbox" style="display: inline;" checked/> Remember (<a href="#" onclick="g_user.showRestoreForm();">Forgot your password?</a>)</label></td></tr></table></td>
|
||||
</tr>
|
||||
<tr><td colspan="2" style="text-align: right;"><input class="button-secondary" id="TLogin_E`+this.uid+`" type="button" style="display: inline;" value="`+trt('Log_in')+`"></td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>`;
|
||||
|
||||
this.win.setContent(str);
|
||||
|
||||
@ -137,14 +137,14 @@ class DBMSUser
|
||||
{
|
||||
obj.onclick=()=>
|
||||
{
|
||||
var xs='<?xml version="1.0" encoding="utf-8"?>\
|
||||
<metadata fn="7">\
|
||||
<cmd><![CDATA[3]]></cmd>\n\
|
||||
<login><![CDATA['+document.getElementById('tcLogin'+this.uid).value+']]></login>\
|
||||
<password><![CDATA['+document.getElementById('tcPassword'+this.uid).value+']]></password>\
|
||||
</metadata>';
|
||||
let xs=`<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata fn="7">
|
||||
<cmd><![CDATA[3]]></cmd>
|
||||
<login><![CDATA[`+document.getElementById('tcLogin'+this.uid).value+`]]></login>
|
||||
<password><![CDATA[`+document.getElementById('tcPassword'+this.uid).value+`]]></password>
|
||||
</metadata>`;
|
||||
|
||||
var request=new TRequest(this);
|
||||
let request=new TRequest(this);
|
||||
if(request.callServer(ScriptName,xs))
|
||||
{
|
||||
this.win.showProgressBar();
|
||||
@ -260,21 +260,21 @@ class DBMSUser
|
||||
//Display password recovery form
|
||||
showRestoreForm()
|
||||
{
|
||||
var win=new TWin(true);
|
||||
let win=new TWin(true);
|
||||
win.BuildGUI(10,10);
|
||||
win.setCaption(trt("Password_recovery"));
|
||||
|
||||
let str='<div style="width: 100%; height: 100%; padding: 4px; text-align: left;">\n\
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%; padding: 0px;">\n\
|
||||
<tr>\n\
|
||||
<td style="padding: 2px; white-space: nowrap"><b>'+trt('Login')+' (E-mail)</b></td>\n\
|
||||
<td style="padding: 2px;"><input type="text" maxlength="40" style="width: 100%; display: inline;" id="'+win.uid+'_email" name="login">\n\
|
||||
<table id="'+win.uid+'_phone" style="width: 100%; display: none;" cellpadding="0" cellspacing="0"><tr><td style="white-space: nowrap;"><b>+7 ( </b><input type="text" maxlength="3" onkeydown="this.value = this.value.replace(/[^0-9]/g, \'\')" onkeyup="this.value = this.value.replace(/[^0-9]/g, \'\')" style="width: 35px; display: inline;" id="'+win.uid+'_phone0" value=""><b> ) </b></td><td style="width: 90%;"><input type="text" onkeydown="this.value = this.value.replace(/[^0-9]/g, \'\')" onkeyup="this.value = this.value.replace(/[^0-9]/g, \'\')" maxlength="7" style="width: 100%;display: inline;" id="'+win.uid+'_phone1" value=""></td></tr></table><br></td>\n\
|
||||
</tr>\n\
|
||||
<tr><td colspan="2" style="text-align: right; padding: 2px;"><input class="button-secondary" id="'+win.uid+'_restore" type="button" style="display: inline;" value="'+trt('Restore')+'"></td></tr>\n\
|
||||
</table>\n\
|
||||
</td></tr>\n\
|
||||
</div>';
|
||||
let str=`<div style="width: 100%; height: 100%; padding: 4px; text-align: left;">
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%; padding: 0px;">
|
||||
<tr>
|
||||
<td style="padding: 2px; white-space: nowrap"><b>`+trt('Login')+` (E-mail)</b></td>
|
||||
<td style="padding: 2px;"><input type="text" maxlength="40" style="width: 100%; display: inline;" id="`+win.uid+`_email" name="login">
|
||||
<table id="`+win.uid+`_phone" style="width: 100%; display: none;" cellpadding="0" cellspacing="0"><tr><td style="white-space: nowrap;"><b>+7 ( </b><input type="text" maxlength="3" onkeydown="this.value = this.value.replace(/[^0-9]/g, \'\')" onkeyup="this.value = this.value.replace(/[^0-9]/g, \'\')" style="width: 35px; display: inline;" id="`+win.uid+`_phone0" value=""><b> ) </b></td><td style="width: 90%;"><input type="text" onkeydown="this.value = this.value.replace(/[^0-9]/g, \'\')" onkeyup="this.value = this.value.replace(/[^0-9]/g, \'\')" maxlength="7" style="width: 100%;display: inline;" id="`+win.uid+`_phone1" value=""></td></tr></table><br></td>
|
||||
</tr>
|
||||
<tr><td colspan="2" style="text-align: right; padding: 2px;"><input class="button-secondary" id="`+win.uid+`_restore" type="button" style="display: inline;" value="`+trt('Restore')+`"></td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</div>`;
|
||||
win.setContent(str);
|
||||
|
||||
//Центрируем окно и отображаем тень
|
||||
@ -294,18 +294,18 @@ class DBMSUser
|
||||
{
|
||||
win.showProgressBar();
|
||||
|
||||
var em=document.getElementById(win.uid+'_email').value;
|
||||
let em=document.getElementById(win.uid+'_email').value;
|
||||
|
||||
if(em==''){ document.getElementById(win.uid+'_email').select(); alert(trt('Not_filled_Email_address')); win.hideProgressBar(); return; }
|
||||
if(! isEmail(em)){ document.getElementById(win.uid+'_email').select(); alert(trt('Please_enter_a_valid_email_address')); win.hideProgressBar(); return; }
|
||||
|
||||
//Send AJAX reqwest to server
|
||||
var xml='<?xml version="1.0" encoding="utf-8"?>\
|
||||
<metadata fn="7">\
|
||||
<cmd><![CDATA[0]]></cmd>\
|
||||
<login><![CDATA['+em+']]></login>\
|
||||
<captcha><![CDATA[]]></captcha>\
|
||||
</metadata>';
|
||||
let xml=`<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata fn="7">
|
||||
<cmd><![CDATA[0]]></cmd>
|
||||
<login><![CDATA[`+em+`]]></login>
|
||||
<captcha><![CDATA[]]></captcha>
|
||||
</metadata>`;
|
||||
|
||||
//Anonymous object
|
||||
obj=new function(win)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
<?
|
||||
//Скрипт должен возвращять время в секундах когда умрёт сесия
|
||||
//Скрипт работающий как AJAX в связке с javascript функцией 1 после загрузки выдать наименование сессионной переменной потом проверять на существование соответствующего файла в базе данных
|
||||
//Проверить обновляется ли файлик сесии
|
||||
//http://leopard.in.ua/2008/09/20/otslezhivanie-istecheniya-sroka-dejstviya-sessij/
|
||||
//session_save_path('C:\ses');
|
||||
|
||||
require_once("../include/tools.php");
|
||||
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$host = '.'.cutAfterLast($host,'.',2);
|
||||
ini_set('session.cookie_domain', $host);
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if(isset($_GET['fn'])) $fn=$_GET['fn']; else $fn='';
|
||||
|
||||
if($fn=='0')
|
||||
{
|
||||
echo session_name();
|
||||
exit;
|
||||
}else
|
||||
if($fn=='1')
|
||||
{
|
||||
@session_start(['cookie_lifetime' => 43200,'cookie_secure' => true,'cookie_httponly' => true]);
|
||||
echo session_id();
|
||||
exit;
|
||||
}else
|
||||
if($fn=='2') //Вернуть время до смерти сесии в секундах
|
||||
{
|
||||
if(isset($_GET[session_name()])) $id=$_GET[session_name()]; else exit;
|
||||
|
||||
$sessionfile = ini_get('session.save_path') . DIRECTORY_SEPARATOR . 'sess_'.$id;
|
||||
if ( file_exists($sessionfile) )
|
||||
{
|
||||
//echo ini_get('session.gc_maxlifetime') - (time() - filemtime($sessionfile));
|
||||
echo '1'; //Чтоб только если файл удалился
|
||||
|
||||
}else echo '-1';
|
||||
exit;
|
||||
}else
|
||||
{
|
||||
echo 'error';
|
||||
}
|
||||
@ -11,11 +11,10 @@ function setFilterVal(uid,id,c,p)
|
||||
|
||||
var SRec_mas = new Array(); //List of all objects "EdtRec" (then something better to think of)
|
||||
|
||||
class SRec extends TWin
|
||||
class SRec
|
||||
{
|
||||
constructor(dialog,path)
|
||||
constructor()
|
||||
{
|
||||
super(dialog,path);
|
||||
this.win=null;
|
||||
this.rwin=null;
|
||||
|
||||
@ -46,19 +45,14 @@ class SRec extends TWin
|
||||
|
||||
this.onUpdate=null; //For call set function
|
||||
this.onInsert=null; //For call set function
|
||||
|
||||
|
||||
//TODO сделать наследование из класса TWin
|
||||
this.parent=null; //родительское окно
|
||||
this.childs=new Array(); //Подчинёные окна
|
||||
}
|
||||
|
||||
|
||||
applyReq(req,fn,node,xmldoc)
|
||||
{
|
||||
this.hideProgressBar();
|
||||
|
||||
if(node.errorCode>0) {
|
||||
alert2(trt('Alert'), node.errorMessage);
|
||||
if(node.error_code>0) {
|
||||
alert2(trt('Alert'), node.error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -156,34 +150,34 @@ class SRec extends TWin
|
||||
|
||||
create(htmlElement)
|
||||
{
|
||||
let str='\
|
||||
<div id="eDiv'+this.uid+'" style="width: 100%; height: 100%; position: relative;">\
|
||||
<table class="SFilter" style="width: 100%; height: 100%;"><tr><td>\
|
||||
<table id="idfilter'+this.uid+'" cellspacing="2" cellpadding="0" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;background-color: var(--row-color-2);" width="100%">\
|
||||
<caption></caption><tbody></tbody>\
|
||||
</table>\
|
||||
</td></tr><tr><td>\
|
||||
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_'+this.uid+'" title="'+trt('Add_record')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_'+this.uid+'" title="'+trt('Delete_record')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_'+this.uid+'" title="'+trt('Export_to_Excel')+'" style="cursor: pointer;"/></td>\
|
||||
<td style="white-space: nowrap; padding-left: 10px;"><label style="display:none;"><input type="checkbox" id="Selection_'+this.uid+'" checked> '+trt('Selection_mode')+'</label></td>\
|
||||
<td style="width: 99%;"> </td>\
|
||||
<td><img src="../resources/metadata/dbms/images/config.png" alt="'+trt('Settings')+'" id="SRec_Cnf_'+this.uid+'" title="'+trt('Settings')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="'+trt('Refresh')+'" id="SRec_Rfr_'+this.uid+'" title="'+trt('Update')+'" style="cursor: pointer;"/></td></tr>\
|
||||
</table>\
|
||||
</td></tr><tr><td id="tblContainer_'+this.uid+'" style="vertical-align:top; overflow:hidden; width:100%; height:100%; text-align:center;">\
|
||||
<div id="tblSContainer_'+this.uid+'" style="position: absolute; overflow:scroll; width: 400px; height: 400px;">\
|
||||
<table id="thetable'+this.uid+'" class="SShow">\
|
||||
<caption></caption>\
|
||||
<thead><tr><th></th></tr></thead>\
|
||||
<tbody><tr><td></td></tr></tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
</td></tr><tr><td>\
|
||||
<center><table id="pages_'+this.uid+'"><tbody><tr><td> </td></tr></tbody></table></center>\
|
||||
</td></tr></table>\
|
||||
</div>\
|
||||
';
|
||||
let str=`
|
||||
<div id="eDiv`+this.uid+`" style="width: 100%; height: 100%; position: relative;">
|
||||
<table class="SFilter" style="width: 100%; height: 100%;"><tr><td>
|
||||
<table id="idfilter`+this.uid+`" cellspacing="2" cellpadding="0" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;background-color: var(--row-color-2);" width="100%">
|
||||
<caption></caption><tbody></tbody>
|
||||
</table>
|
||||
</td></tr><tr><td>
|
||||
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_`+this.uid+`" title="`+trt('Add_record')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_`+this.uid+`" title="`+trt('Delete_record')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_`+this.uid+`" title="`+trt('Export_to_Excel')+`" style="cursor: pointer;"/></td>
|
||||
<td style="white-space: nowrap; padding-left: 10px;"><label style="display:none;"><input type="checkbox" id="Selection_`+this.uid+`" checked> `+trt('Selection_mode')+`</label></td>
|
||||
<td style="width: 99%;"> </td>
|
||||
<td><img src="../resources/metadata/dbms/images/config.png" alt="`+trt('Settings')+`" id="SRec_Cnf_`+this.uid+`" title="`+trt('Settings')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="`+trt('Refresh')+`" id="SRec_Rfr_`+this.uid+`" title="`+trt('Update')+`" style="cursor: pointer;"/></td></tr>
|
||||
</table>
|
||||
</td></tr><tr><td id="tblContainer_`+this.uid+`" style="vertical-align:top; overflow:hidden; width:100%; height:100%; text-align:center;">
|
||||
<div id="tblSContainer_`+this.uid+`" style="position: absolute; overflow:scroll; width: 400px; height: 400px;">
|
||||
<table id="thetable`+this.uid+`" class="SShow">
|
||||
<caption></caption>
|
||||
<thead><tr><th></th></tr></thead>
|
||||
<tbody><tr><td></td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td></tr><tr><td>
|
||||
<center><table id="pages_`+this.uid+`"><tbody><tr><td> </td></tr></tbody></table></center>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(htmlElement==null || typeof(htmlElement) == "undefined")
|
||||
{
|
||||
@ -829,7 +823,7 @@ class SRec extends TWin
|
||||
{
|
||||
let input = document.createElement('input');
|
||||
input.setAttribute("type","text");
|
||||
button.classList.add('DBMS');
|
||||
input.classList.add('DBMS');
|
||||
input.style.cssText="width: 100%;";
|
||||
input.onkeydown=(e)=>{ if(e==null) e=window.event; if(e.keyCode==13) { this.appendFilter(); this.sendFilter(-1,0); }};
|
||||
input.setAttribute("name",columnNode.getAttribute("n"));
|
||||
@ -1243,7 +1237,7 @@ class SRec extends TWin
|
||||
let tr = document.createElement('tr');
|
||||
tr.onmouseover=function(){ this.style.backgroundColor="var(--btn-color2)"; };
|
||||
tr.onmouseout=function(val1,val2){return function(){val1.style.backgroundColor=val2;}}(tr,bgColor);
|
||||
tr.setAttribute("id",''+id+'_'+this.uid);
|
||||
tr.setAttribute("id",id+'_'+this.uid);
|
||||
tr.style.backgroundColor=bgColor;
|
||||
|
||||
//sequential record number
|
||||
@ -1287,7 +1281,7 @@ class SRec extends TWin
|
||||
else textNode=document.createTextNode("");
|
||||
|
||||
//td.setAttribute("id",id+this.masCL[colN].getAttribute("n")); //so that you can identify each record when you update
|
||||
td.setAttribute("id",""+id+"_"+this.masCL[colN].getAttribute("n")); //so that you can identify each record when you update
|
||||
td.setAttribute("id",id+this.masCL[colN].n); //so that you can identify each record when you update
|
||||
td.appendChild(textNode);
|
||||
//if in the metadata for this column there is a reference object then add a link
|
||||
if (this.masCT[colN]!=null)
|
||||
@ -1449,11 +1443,10 @@ class SRec extends TWin
|
||||
}
|
||||
}
|
||||
|
||||
//Get column number by name, if result=-1 then not find else find
|
||||
//Get column number by name
|
||||
getColN(name){
|
||||
let result=-1;
|
||||
let i=-1;
|
||||
//determine the sequence number of the column
|
||||
let pos=0;
|
||||
let node=findNodeOnPath(this.nodeMetadata,"type/objects-list");
|
||||
let nodeCol = node.firstChild;
|
||||
while (nodeCol != null)
|
||||
@ -1461,14 +1454,13 @@ class SRec extends TWin
|
||||
if(nodeCol.nodeName=="column")
|
||||
{
|
||||
if(nodeCol.getAttribute("n")==name){
|
||||
result=pos;
|
||||
break;
|
||||
}
|
||||
pos++;
|
||||
i++;
|
||||
}
|
||||
nodeCol = nodeCol.nextSibling;
|
||||
}
|
||||
return result;
|
||||
return i;
|
||||
}
|
||||
|
||||
//find the value in the result set by the id of the record and the name of the column
|
||||
@ -1479,7 +1471,7 @@ class SRec extends TWin
|
||||
let pos=this.getColN(col);
|
||||
if(pos>=0){
|
||||
for(let i=0;i<this.f_nodeData.data.length;i++){
|
||||
if(this.f_nodeData.data[i].id==id){
|
||||
if(this.f_nodeData.data[i].id=id){
|
||||
return this.f_nodeData.data[i].row[pos];
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,13 +3,6 @@
|
||||
|
||||
//var g_translations = {'':''};
|
||||
|
||||
function removeChild(parent){
|
||||
if(parent==null) return;
|
||||
while (parent.firstChild) {
|
||||
parent.removeChild(parent.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
//Массив g_translations подгружается отдельно
|
||||
function trt(key)
|
||||
{
|
||||
@ -133,8 +126,8 @@ function MMove(e)
|
||||
let obj=document.getElementById("pBarIco");
|
||||
if(obj!=null)
|
||||
{
|
||||
obj.style.left=(pageX+10)+'px';
|
||||
obj.style.top=(pageY-20)+'px';
|
||||
obj.style.left=(pageX+15)+'px';
|
||||
obj.style.top=(pageY)+'px';
|
||||
}
|
||||
}
|
||||
document.onmousemove = MMove;
|
||||
@ -205,9 +198,11 @@ function showProgressBarIco()
|
||||
let img=document.createElement("img");
|
||||
img.id='pBarIco';
|
||||
img.style.cssText='position: absolute; left: 0px; top: 0px; z-index: 1000;';
|
||||
img.style.left=(pageX+10)+'px';
|
||||
img.style.top=(pageY-20)+'px';
|
||||
img.src = "../resources/images/loader3.gif";
|
||||
img.style.left=(pageX+15)+'px';
|
||||
img.style.top=(pageY)+'px';
|
||||
img.style.width = "32px";
|
||||
img.style.height = "32px";
|
||||
img.src = "../resources/images/loader3.svg";
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
cntShPrBICnt++;
|
||||
@ -336,20 +331,20 @@ 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 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%;">'+(fullText === undefined || fullText == '' ? '' : '<label><input type="checkbox" id="show_'+win.uid+'" name="scales"> '+trt('Full_text')+'</label>')+' </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>';
|
||||
let html=`
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
|
||||
<tr id="smallText_`+win.uid+`" style="width: 100%;">
|
||||
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">`+smallText+`</td>
|
||||
</tr>
|
||||
<tr id="fullText_`+win.uid+`" style="width: 100%; display: none;">
|
||||
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">`+fullText+`</td>
|
||||
</tr>
|
||||
<tr style="height: 10px;">
|
||||
<td style="width: 100%;">`+(fullText === undefined || fullText == '' ? '' : '<label><input type="checkbox" id="show_'+win.uid+'" name="scales"> '+trt('Full_text')+'</label>')+` </td>
|
||||
<td><button class="button-secondary" id="`+win.uid+`_ok" style="width: 80px;margin:1px;">`+trt('Ok')+`</button></td>
|
||||
<td><button class="button-secondary" id="`+win.uid+`_cancel" style="width: 80px;margin:1px;">`+trt('Cancel')+`</button></td>
|
||||
</tr>
|
||||
</table>`;
|
||||
|
||||
win.setContent(html);
|
||||
|
||||
@ -398,23 +393,23 @@ 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>';
|
||||
let html=`
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
|
||||
<tr style="width: 100%;">
|
||||
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">`+smallText+`</td>
|
||||
</tr>
|
||||
<tr style="width: 100%;">
|
||||
<td colspan="3" style="width: 100%;">`+fieldText+`</td>
|
||||
</tr>
|
||||
<tr style="width: 100%;">
|
||||
<td colspan="3" style="width: 100%;"><textarea rows="5" style="width: 100%;" id="text_`+win.uid+`">`+defaultText+`</textarea></td>
|
||||
</tr>
|
||||
<tr style="height: 10px;">
|
||||
<td style="width: 100%;"> </td>
|
||||
<td><button class="button-secondary" id="`+win.uid+`_ok" style="width: 80px;margin:1px;">`+trt('Ok')+`</button></td>
|
||||
<td><button class="button-secondary" id="`+win.uid+`_cancel" style="width: 80px;margin:1px;">`+trt('Cancel')+`</button></td>
|
||||
</tr>
|
||||
</table>`;
|
||||
|
||||
win.setContent(html);
|
||||
|
||||
@ -638,7 +633,7 @@ function getCookie(c_name)
|
||||
|
||||
//expires - Сколько дней хранить куки
|
||||
//path - Путь куда разрешено пересылать куки (по умолчанию текущий)
|
||||
function setCookie(name, value, expires, path, domain, secure)
|
||||
function setCookie (name, value, expires, path, domain, secure)
|
||||
{
|
||||
let exDate=new Date();
|
||||
exDate.setDate(exDate.getDate() + expires);
|
||||
@ -648,8 +643,8 @@ function setCookie(name, value, expires, path, domain, secure)
|
||||
((expires) ? "; expires=" + expires : "") +
|
||||
((path) ? "; path=" + path : "") +
|
||||
((domain) ? "; domain=" + domain : "") +
|
||||
((secure) ? "; secure" : "") +
|
||||
"; SameSite=Strict";
|
||||
((secure) ? "; secure" : "");
|
||||
|
||||
document.cookie = str;
|
||||
}
|
||||
|
||||
@ -1208,7 +1203,7 @@ class TRequest
|
||||
{
|
||||
if(typeof(xmlHttpRequest.status)=='undefined' || xmlHttpRequest.status == 200)
|
||||
{
|
||||
//console.log()
|
||||
//console.log(JSON.stringify(xmlHttpRequest));
|
||||
if(xmlHttpRequest.responseXML!=null) {
|
||||
//if(typeof(xmlHttpRequest.responseXML)=='undefined' && xmlHttpRequest.contentType.match(/\/xml/)) //For IE XDomainRequest
|
||||
// xmlHttpRequest.responseXML=CreateXMLDOC(xmlHttpRequest.responseText);
|
||||
@ -1368,494 +1363,6 @@ class myXMLHttpRequest
|
||||
}
|
||||
}
|
||||
|
||||
//Класс окна
|
||||
class TWin
|
||||
{
|
||||
constructor(dialog,path)
|
||||
{
|
||||
this.uid=getUID(); //Уникальныйидентификатор
|
||||
|
||||
this.dialog=dialog; //Показывать окно как диалог (без возможности изменения размеров)
|
||||
if(typeof path !== 'undefined')
|
||||
this.path=path;
|
||||
else
|
||||
this.path='../resources';
|
||||
|
||||
this.disableClosing=false;
|
||||
|
||||
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.pBarCnt=0; //Прогресс бар
|
||||
this.pBarDiv=null; //Прогресс бар
|
||||
|
||||
this.fnResizeListener=null;
|
||||
}
|
||||
|
||||
addResizeListener(func)
|
||||
{
|
||||
this.fnResizeListener=func;
|
||||
this.fnResizeListener();
|
||||
}
|
||||
|
||||
onResize(x,y)
|
||||
{
|
||||
let win=this;
|
||||
return function(e){
|
||||
if(!e) e = window.event;
|
||||
win.dx=e.pageX || e.x
|
||||
win.dy=e.pageY || e.y
|
||||
|
||||
document.onmousedown = function() {
|
||||
|
||||
if(win.fnResizeListener!=null) win.fnResizeListener();
|
||||
|
||||
return false;
|
||||
};
|
||||
document.onmousemove = function(e) {
|
||||
if(!e) e = window.event;
|
||||
let x2 = e.pageX || e.x;
|
||||
let y2 = e.pageY || e.y;
|
||||
let w=parseInt(win.div.style.width)-(win.dx-x2)*x;
|
||||
let h=parseInt(win.div.style.height)-(win.dy-y2)*y;
|
||||
if(w<0)w=0;
|
||||
if(h<0)h=0;
|
||||
win.setWidth(w+"px");
|
||||
win.setHeight(h+"px");
|
||||
if(x<0)win.div.style.left=parseInt(win.div.style.left)-(win.dx-x2)+"px";
|
||||
if(y<0)win.div.style.top=parseInt(win.div.style.top)-(win.dy-y2)+"px";
|
||||
win.dx=x2;
|
||||
win.dy=y2;
|
||||
|
||||
if(win.fnResizeListener!=null) win.fnResizeListener();
|
||||
|
||||
return false;
|
||||
};
|
||||
document.onmouseup = function() {
|
||||
document.onmousedown = null;
|
||||
document.onmousemove = MMove//null;
|
||||
|
||||
if(win.fnResizeListener!=null) win.fnResizeListener();
|
||||
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
Close() //Закрыть и удалить окно из родителя и менеджера
|
||||
{
|
||||
if(this.disableClosing)
|
||||
return;
|
||||
|
||||
//Переместил перед удалением компонент так как бывает нужно поработать с ними перед удалением
|
||||
if(this.onClose!=null)
|
||||
{
|
||||
this.onClose();
|
||||
}
|
||||
|
||||
this.hide(true);
|
||||
this.setParent(null);
|
||||
for(let i=0;i<this.childs.length;i++) if(this.childs[i]!=null) this.childs[i].parent=null
|
||||
|
||||
//??? зачем коментил (пояснение не понятное)? раскоментил потому что после пересоздания формы HTML id сохранялись (Вот непонятный комент: Закоментил потому что в магазине могут закрыть окно а оно больше не появится...)
|
||||
if(this.div.parentNode!=null) this.div.parentNode.removeChild(this.div);
|
||||
if(this.divsh.parentNode!=null) this.divsh.parentNode.removeChild(this.divsh);
|
||||
|
||||
this.closed=true;
|
||||
};
|
||||
|
||||
//Типа конструктор создать окно с заданой позицией
|
||||
BuildGUI(x,y)
|
||||
{
|
||||
this.tWinId=Wins.add(this);
|
||||
/*
|
||||
let hd='';
|
||||
hd+='<table style="width: 100%;">';
|
||||
hd+=' <tr>';
|
||||
hd+=' <td style="vertical-align:bottom;cursor:move;" id="TWin_H1_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/t1.gif" style="width: 20px; height: 20px; display: block;" alt="" border="0px" draggable="false"/></td>';
|
||||
hd+=' <td align="center" width="100%" bgcolor="#3366CC" style="font-weight: bold; cursor:move; background: #92b5df url('+this.path+'/metadata/dbms/form/1.gif) repeat-x top;" id="TWin_H2_'+this.tWinId+'"><nobr id="TWin_Ca_'+this.tWinId+'"></nobr></td>';
|
||||
hd+=' <td style="vertical-align:bottom;cursor:move;" id="TWin_H3_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/t2.gif" alt="" style="width: 20px; height: 20px; display: block;" border="0px" draggable="false"/></td>';
|
||||
//hd+=' <td width="100%"> </td>';
|
||||
hd+=' <td style="vertical-align:bottom;cursor:pointer;"><img src="'+this.path+'/metadata/dbms/form/none.gif" alt="" style="width: 21px; height: 21px; display: block;" border="0px" draggable="false"/></td>';
|
||||
hd+=' <td style="vertical-align:bottom;cursor:pointer;"><img src="'+this.path+'/metadata/dbms/form/none.gif" alt="" style="width: 21px; height: 21px; display: block;" border="0px" draggable="false"/></td>';
|
||||
hd+=' <td style="vertical-align:bottom;cursor:pointer;"><img src="'+this.path+'/metadata/dbms/form/close.gif" alt="X" style="width: 21px; height: 21px; display: block;" border="0px" draggable="false" id="TWin_CL_'+this.tWinId+'"/></td>';
|
||||
hd+=' <td style="vertical-align:bottom;"><img src="'+this.path+'/metadata/dbms/form/none.gif" alt="" style="width: 21px; height: 21px; display: block;" border="0px" draggable="false"/></td>';
|
||||
hd+=' </tr>';
|
||||
hd+='</table>';
|
||||
|
||||
let str='';
|
||||
str+='<table id="TWin_TBL_'+this.tWinId+'" border="0px" style="width: 100%; height: 100%;">';
|
||||
str+=' <tr id="TWin_H0_'+this.tWinId+'"><td colspan=3>'+hd+'</td></tr>';
|
||||
str+=' <tr>';
|
||||
str+=' <td style="width: 10px; height: 10px; cursor:nw-resize;"><img src="'+this.path+'/metadata/dbms/form/_t-l.gif" alt="" style="width: 10px; height: 10px; display: block;" border="0px" draggable="false" id="TWin_TL_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="vertical-align:top; height: 10px; cursor:n-resize;" background="'+this.path+'/metadata/dbms/form/t.gif" id="TWin_T_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="width: 10px; height: 10px; cursor:ne-resize;" id="TWin_TR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/t-r.gif" alt="" style="width: 10px; height: 10px; display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr style="height: 100%">';
|
||||
str+=' <td style="vertical-align:top;height: 10px; cursor:w-resize;" background="'+this.path+'/metadata/dbms/form/l.gif" id="TWin_L_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="vertical-align:top;cursor:default;"><table style="width: 100%; height: 100%;"><tr><td id="TWin_Co_'+this.tWinId+'" style="vertical-align:top;"> </td></tr></table></td>';
|
||||
str+=' <td style="vertical-align: top; height: 10px; cursor:e-resize;" background="'+this.path+'/metadata/dbms/form/r.gif" id="TWin_R_'+this.tWinId+'"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr>';
|
||||
str+=' <td style="width: 10px; height: 10px; cursor:sw-resize;" id="TWin_BL_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/b-l.gif" alt="" style="width: 10px; height: 10px; display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' <td style="vertical-align: top; height: 10px; cursor:s-resize;" background="'+this.path+'/metadata/dbms/form/b.gif" id="TWin_B_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="width: 10px; height: 10px; cursor:se-resize;" id="TWin_BR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/b-r.gif" alt="" style="width: 10px; height: 10px; display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+='</table>';
|
||||
*/
|
||||
/*
|
||||
let str='';
|
||||
str+='<table id="TWin_TBL_'+this.tWinId+'" class="TWin">';
|
||||
str+=' <tr id="TWin_H0_'+this.tWinId+'" style="border-bottom: 1px solid #b3b3b3;"><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;"><img src="'+this.path+'/metadata/dbms/form/x.gif" id="TWin_CL_'+this.tWinId+'" style="cursor:pointer;"></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>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:ne-resize;' : '')+'" id="TWin_TR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr style="height: 100%">';
|
||||
str+=' <td style="height: 5px;'+(!this.dialog ? ' cursor:w-resize;' : '')+'" id="TWin_L_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="vertical-align:top; cursor: default;"><table style="width: 100%; height: 100%;"><tr><td id="TWin_Co_'+this.tWinId+'" style="vertical-align:top;"></td></tr></table></td>';
|
||||
str+=' <td style="height: 5px;'+(!this.dialog ? ' cursor:e-resize;' : '')+'" id="TWin_R_'+this.tWinId+'"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:sw-resize;' : '')+'" id="TWin_BL_'+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: s-resize;' : '')+'" id="TWin_B_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:se-resize;' : '')+'" id="TWin_BR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+='</table>';
|
||||
*/
|
||||
|
||||
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); 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>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:ne-resize;' : '')+'" id="TWin_TR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr style="height: 100%">';
|
||||
str+=' <td style="height: 5px;'+(!this.dialog ? ' cursor:w-resize;' : '')+'" id="TWin_L_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="vertical-align:top;cursor:default;"><table style="width: 100%; height: 100%;"><tr><td id="TWin_Co_'+this.tWinId+'" style="vertical-align:top;"></td></tr></table></td>';
|
||||
str+=' <td style="height: 5px;'+(!this.dialog ? ' cursor:e-resize;' : '')+'" id="TWin_R_'+this.tWinId+'"></td>';
|
||||
str+=' </tr>';
|
||||
str+=' <tr>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:sw-resize;' : '')+'" id="TWin_BL_'+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:s-resize;' : '')+'" id="TWin_B_'+this.tWinId+'"></td>';
|
||||
str+=' <td style="width: 5px; height: 5px;'+(!this.dialog ? ' cursor:se-resize;' : '')+'" id="TWin_BR_'+this.tWinId+'"><img src="'+this.path+'/metadata/dbms/form/5.gif" alt="" style="display: block;" border="0px" draggable="false"></td>';
|
||||
str+=' </tr>';
|
||||
str+='</table>';
|
||||
|
||||
//создаём невидемую тень
|
||||
this.divsh.style.cssText="display: none; position: fixed; top:0; left:0; height: 100%; width: 100%; background: rgba(0,0,0,0.3);";
|
||||
this.divsh.onclick=function(win){return function(){ win.Close(); };}(this);
|
||||
|
||||
document.body.appendChild( this.divsh );
|
||||
|
||||
//Создаём родительский элемент для окна
|
||||
this.div = document.createElement('div');
|
||||
this.div.setAttribute("id","TWin_"+this.tWinId);
|
||||
this.div.style.cssText="position:absolute; height:50px; width:640px;";
|
||||
this.div.innerHTML=str;
|
||||
document.body.appendChild( this.div );
|
||||
this.tbl=document.getElementById('TWin_TBL_'+this.tWinId);
|
||||
this.h0=document.getElementById('TWin_H0_'+this.tWinId);
|
||||
this.co=document.getElementById('TWin_Co_'+this.tWinId);
|
||||
this.ca=document.getElementById('TWin_Ca_'+this.tWinId);
|
||||
this.setSel();
|
||||
|
||||
this.div.onmousedown=(e)=>this.setSel();
|
||||
//Кнопка закрыть окно
|
||||
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)
|
||||
{
|
||||
document.getElementById('TWin_B_'+this.tWinId).onmousedown=this.onResize(0,1);
|
||||
document.getElementById('TWin_T_'+this.tWinId).onmousedown=this.onResize(0,-1);
|
||||
document.getElementById('TWin_BR_'+this.tWinId).onmousedown=this.onResize(1,1);
|
||||
document.getElementById('TWin_TL_'+this.tWinId).onmousedown=this.onResize(-1,-1);
|
||||
document.getElementById('TWin_BL_'+this.tWinId).onmousedown=this.onResize(-1,1);
|
||||
document.getElementById('TWin_R_'+this.tWinId).onmousedown=this.onResize(1,0);
|
||||
document.getElementById('TWin_L_'+this.tWinId).onmousedown=this.onResize(-1,0);
|
||||
document.getElementById('TWin_TR_'+this.tWinId).onmousedown=this.onResize(1,-1);
|
||||
}
|
||||
|
||||
this.setMove(document.getElementById('TWin_H0_'+this.tWinId));
|
||||
//this.setMove(document.getElementById('TWin_H1_'+this.tWinId));
|
||||
//this.setMove(document.getElementById('TWin_H2_'+this.tWinId));
|
||||
//this.setMove(document.getElementById('TWin_H3_'+this.tWinId));
|
||||
|
||||
this.setLeftTop(x,y);
|
||||
}
|
||||
|
||||
getCaption()
|
||||
{
|
||||
return document.getElementById('TWin_Ca_'+this.tWinId);
|
||||
}
|
||||
|
||||
setCaption(val)
|
||||
{
|
||||
if(val==null) val='';
|
||||
let obj=document.getElementById('TWin_Ca_'+this.tWinId);
|
||||
if (typeof val === 'string' || val instanceof String)
|
||||
obj.innerHTML=val;
|
||||
else
|
||||
obj.appendChild(val);
|
||||
}
|
||||
|
||||
//Присвоить содержимое в виде строки
|
||||
setContent(html)
|
||||
{
|
||||
let obj=document.getElementById('TWin_Co_'+this.tWinId);
|
||||
if(obj!=null)
|
||||
{
|
||||
obj.innerHTML=html;
|
||||
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";
|
||||
}
|
||||
}
|
||||
//Выбрать (активизировать) окно
|
||||
setSel()
|
||||
{
|
||||
for(let i=0;i<Wins.mas.length;i++) if(Wins.mas[i]!=null)
|
||||
{
|
||||
Wins.mas[i].sel=false;
|
||||
Wins.mas[i].ca.style.color="var(--inactive-font-color)";
|
||||
}
|
||||
this.sel=true;
|
||||
this.ca.style.color="var(--main-font-color)";
|
||||
this.setWinZ(true);
|
||||
}
|
||||
//Получить значение Z индекса TODO сделать через геттер
|
||||
getZ()
|
||||
{
|
||||
return parseInt(this.div.style.zIndex);
|
||||
}
|
||||
//Установить значение Z индекса TODO сделать через setter
|
||||
setZ(z)
|
||||
{
|
||||
this.div.style.zIndex=z;
|
||||
this.divsh.style.zIndex=z-1;
|
||||
};
|
||||
setMove(elm)
|
||||
{
|
||||
elm.onmousedown=function(win){
|
||||
return function(event){
|
||||
move_me(event,win);
|
||||
};
|
||||
}(this);
|
||||
};
|
||||
//В центр видимой части экрана
|
||||
setCenter()
|
||||
{
|
||||
let scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
||||
let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
|
||||
this.div.style.left=(scrollLeft+((document.documentElement.clientWidth || document.body.clientWidth)-parseInt(this.div.style.width))/2)+"px"
|
||||
this.div.style.top=(scrollTop+((document.documentElement.clientHeight || document.body.clientHeight)-parseInt(this.div.style.height))/2)+"px"
|
||||
if(parseInt(this.div.style.top)<0) this.div.style.top="1px";
|
||||
if(parseInt(this.div.style.left)<0) this.div.style.left="1px";
|
||||
};
|
||||
setLeftTop(x,y)
|
||||
{
|
||||
this.div.style.left=x+"px"
|
||||
if(y<0) y=0;this.div.style.top=y+"px"
|
||||
};
|
||||
setTop(y){if(y<0) y=0;this.div.style.top=y+"px"};
|
||||
getTop(){return parseInt(this.div.style.top)};
|
||||
getLeft(){return parseInt(this.div.style.left)};
|
||||
|
||||
setSize(w,h)
|
||||
{
|
||||
this.setWidth(w)
|
||||
this.setHeight(h)
|
||||
};
|
||||
//Где w вида '100px' или '100%'
|
||||
setWidth(w)
|
||||
{ if(w==null || w=='') return;
|
||||
w=''+w;
|
||||
if(w.indexOf('px')<0 && w.indexOf('%')<0) w+='px'; //По умолчанию пиксели
|
||||
this.div.style.width=w
|
||||
if(this.tbl.offsetWidth>this.div.offsetWidth) this.div.style.width=this.tbl.offsetWidth+"px"
|
||||
};
|
||||
|
||||
getWidth(){
|
||||
if(this.tbl!=null)
|
||||
return parseInt(this.tbl.offsetWidth);
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
setHeight(h)
|
||||
{
|
||||
if(h==null || h=='') return;
|
||||
h=''+h;
|
||||
if(h.indexOf('%')>-1) h=(this.div.parentNode.offsetHeight/100*parseInt(h));
|
||||
|
||||
this.co.style.height=(parseInt(h)-20-this.h0.offsetHeight)+"px";
|
||||
this.div.style.height=parseInt(h)+'px';
|
||||
|
||||
if(this.tbl.offsetHeight>this.div.offsetHeight)
|
||||
this.div.style.height=this.tbl.offsetHeight+"px";
|
||||
};
|
||||
|
||||
//Подстроить размер окна по содержимому
|
||||
/*adjustHeight()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
//Подгрузить содержимое окна из указаного места
|
||||
//json - объект который передастца в виде JSON строки по URL
|
||||
//func - функция которая выполниться после загрузки данных в форму
|
||||
load(url,json,func,tr)
|
||||
{
|
||||
this.showProgressBar();
|
||||
var r=createRequestObject();
|
||||
r.onreadystatechange = function(r,w,thiz,func)
|
||||
{
|
||||
return function(){
|
||||
if(r.readyState == 4){
|
||||
if(tr) w.innerHTML=trts(r.responseText);
|
||||
else w.innerHTML=r.responseText;
|
||||
thiz.hideProgressBar();
|
||||
if(func !== undefined && func!=null) func();
|
||||
|
||||
//Для подстройки формы под новый размер, а то showProgressBar не по размеру было
|
||||
thiz.div.style.width=thiz.tbl.offsetWidth+"px"
|
||||
thiz.div.style.height=thiz.tbl.offsetHeight+"px";
|
||||
|
||||
thiz.setCenter();
|
||||
}
|
||||
}
|
||||
}(r,this.co,this,func,tr)
|
||||
r.open( "POST", url, true );
|
||||
if(json!=null)
|
||||
r.send(JSON.stringify(json));
|
||||
else
|
||||
r.send();
|
||||
};
|
||||
|
||||
//Переместить окно на передний план (Обычно при щелчке на нём)
|
||||
setWinZ(s)
|
||||
{
|
||||
let i;
|
||||
this.setZ(Wins.getMaxZ()+2); //+2 это для тени
|
||||
if(s && this.parent!=null) //Переносим текущий элемент в 0й элемент массива детей родительского
|
||||
{
|
||||
var tmp=this.parent.childs[0];
|
||||
for(i=1;i<this.parent.childs.length;i++)
|
||||
{
|
||||
if(tmp==this) break;
|
||||
let t=this.parent.childs[i];
|
||||
this.parent.childs[i]=tmp;
|
||||
tmp=t;
|
||||
}
|
||||
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) //Забыл зачем это делаю
|
||||
}
|
||||
setParent(w)
|
||||
{
|
||||
if(this.parent!=null)
|
||||
{
|
||||
for(let i=0;i<this.parent.childs.length;i++) if(this.parent.childs[i]==this) this.parent.childs[i]=null;
|
||||
}
|
||||
if(typeof w !== 'undefined' && w!=null)
|
||||
{
|
||||
this.parent=w;
|
||||
w.childs[w.childs.length]=this;
|
||||
}
|
||||
}
|
||||
hide(val)
|
||||
{
|
||||
if(val)
|
||||
{ this.div.style.display='none';
|
||||
this.divsh.style.display='none';
|
||||
}else
|
||||
{
|
||||
this.div.style.display='inline';
|
||||
if(this.shadow) this.divsh.style.display='block';
|
||||
}
|
||||
}
|
||||
|
||||
//Показать прогрес бар
|
||||
showProgressBar()
|
||||
{
|
||||
this.pBarCnt++;
|
||||
if(this.pBarDiv==null)
|
||||
{
|
||||
var img='loading.gif';
|
||||
if(this.getWidth()<230) img='loading3.gif';
|
||||
|
||||
this.pBarDiv=document.createElement('div');
|
||||
this.pBarDiv.style.cssText='position: absolute; left: 0px; top: 0px; z-index: 1; width:100%; height: 100%; margin-top:30px; padding-bottom:30px;';
|
||||
this.pBarDiv.innerHTML='<table style="background-color: rgba(0,0,0,0.5);" width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="vertical-align: middle;"><img src="'+this.path+'/metadata/dbms/images/'+img+'" alt=""></td></tr></table>';
|
||||
|
||||
//var eDiv=document.getElementById('eDiv'+this.uid);
|
||||
this.div.appendChild(this.pBarDiv);
|
||||
}
|
||||
}
|
||||
|
||||
//Спрятать прогрес бар
|
||||
hideProgressBar()
|
||||
{
|
||||
this.pBarCnt--;
|
||||
if(this.pBarCnt<=0)
|
||||
{
|
||||
if(this.pBarDiv!==null) deleteHTML(this.pBarDiv);
|
||||
this.pBarCnt=0;
|
||||
this.pBarDiv=null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TWins
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this.mas = new Array();
|
||||
}
|
||||
add(win) //Добавить окно в список
|
||||
{
|
||||
this.mas.push(win);
|
||||
return this.mas.length-1;
|
||||
};
|
||||
getMaxZ() //Получить максимальный Z индекс
|
||||
{
|
||||
var z=100; //По умолчанию
|
||||
for(var i=0;i<this.mas.length;i++) if(this.mas[i]!==null && this.mas[i].getZ()>z) z=this.mas[i].getZ();
|
||||
return z;
|
||||
};
|
||||
getSel() //Получить выделенное окно
|
||||
{
|
||||
for(var i=0;i<this.mas.length;i++) if(this.mas[i].sel) return this.mas[i];
|
||||
return null;
|
||||
};
|
||||
}
|
||||
var Wins=new TWins(); //Global object
|
||||
|
||||
//список параметров (TODO для чего использую?)
|
||||
class TSettings
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user