После проверки на ИБ

This commit is contained in:
2025-07-17 18:45:40 +05:00
parent 65fe6498cd
commit e7a712af02
11 changed files with 112 additions and 2908 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,443 +0,0 @@
package dbms;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
//import javax.servlet.ServletContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import jakarta.servlet.ServletContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.context.ServletContextAware;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import tctable.Tools;
import tools.DBTools;
import tools.XMLTools;
import tools.User;
@Controller
public class DBMSTree implements ServletContextAware {
private static final Logger logger = LoggerFactory.getLogger(DBMSTree.class);
private ServletContext context;
@RequestMapping(value = "/tree",method = RequestMethod.POST,produces = "application/xml; charset=utf-8")
@ResponseBody
public Object ajaxTamer(@ModelAttribute User user,@RequestBody byte[] reqData,@RequestParam(required=false,name="lng") String language_id) {
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);
boolean error=false;
String result="<metadata fn=\"-1\"><![CDATA[Request not processed!]]></metadata>";
String jspPath = context.getRealPath("/");
String db_url="";
String db_login="";
String db_password="";
Properties prop = new Properties();
try {
prop.load(new FileInputStream("org_ccalm_main.properties")); // load a properties file
db_url = prop.getProperty("spring.datasource.url");
db_login = prop.getProperty("spring.datasource.username");
db_password = prop.getProperty("spring.datasource.password");
} catch (Exception e) {
e.printStackTrace();
logger.error("Error load org_ccalm_main.properties",e);
}
Connection conn = null;
try {
Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection(db_url, db_login, db_password);
if (conn != null) {
logger.info("Connect is OK!");
} else {
error=true;
result="<metadata fn=\"-1\"><![CDATA[An error occurred while connecting to the database!]]></metadata>";
}
} catch (Exception ex) {
logger.info(ex.getMessage());
error=true;
result="<metadata fn=\"-1\"><![CDATA[An error occurred while connecting to the database!]]></metadata>";
}
String fn="";
String treeid="";
String htmlid="";
//Парсим принятый XML запрос
InputStream body = new ByteArrayInputStream(reqData);
Document doc = null;
Element reqNode = null;
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(body);
} catch (Exception ex) {
logger.info(ex.getMessage());
return "<metadata fn=\"-1\"><![CDATA[Parsing request error!]]></metadata>";
}
if (doc != null) {
reqNode = doc.getDocumentElement();
}
//Парсим XML из файла
Document objXMLDocument = null;
try {
File inputFile = new File(jspPath+"resources"+File.separator+"engine/tree.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
objXMLDocument = dBuilder.parse(inputFile);
} catch (Exception ex) {
logger.info(ex.getMessage());
error=true;
}
Node mainNode=null;
//находим нужный узел в tree.xml для того чтобы выполнить запрос
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
if (doc != null) {
Object exprResult=null;
try {
XPathExpression expr = xpath.compile("//metadata/type[@id='" + treeid + "']");
exprResult = expr.evaluate(doc, XPathConstants.NODESET);
} catch (XPathExpressionException ex) {
logger.info(ex.getMessage());
}
NodeList nodeList = (NodeList) exprResult;
if (nodeList.getLength() > 0)
mainNode = nodeList.item(0);
}
String retrez="";
if(mainNode!=null)
{
//перебераем все дочерние элементы и для каждого выполняем запрос c фильтрацией
Node currNode = mainNode.getFirstChild(); //из tree.xml
while (currNode != null)
{
Node tmpNode=currNode; //если узел goto
if (tmpNode.getNodeName().equals("goto")) //если встретилась "зацикливалка"
{
treeid = tmpNode.getAttributes().getNamedItem("id").getNodeValue();
tmpNode=XMLTools.findFirstNodeOnAttribute(objXMLDocument.getDocumentElement(),"type","id",treeid);
if(tmpNode==null) { currNode = currNode.getNextSibling(); continue; }
}
if(tmpNode.getNodeName().equals("type")) //если выборка из базы
{
treeid=tmpNode.getAttributes().getNamedItem("id").getNodeValue();
String caption=tmpNode.getAttributes().getNamedItem("c").getNodeValue();
//j=0;
XMLTools.applyNodeToNode(reqNode,tmpNode,"n");
//Переносим значения в SQL запрос из фильтра
String sql=XMLTools.getCDATAValue(XMLTools.findNode(tmpNode,"sql-query"));
Node nFs=XMLTools.findNode(tmpNode, "filter");
if(nFs!=null)
{
Node nF=nFs.getFirstChild();
while(nF != null)
{
if(nF.getNodeName().equals("column"))
{
String vt = nF.getAttributes().getNamedItem("vt").getNodeValue();
String val= XMLTools.getCDATAValue(nF);
sql = sql.replace("${" + nF.getAttributes().getNamedItem("n").getNodeValue() + "}", DBTools.getSQLValue(vt, val));
}
nF=nF.getNextSibling();
}
}
//Выполняем подготовленный SQL
Statement stmt;
ResultSet rs=null;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
}
//res=fnGetData(reqNode,tmpNode);//currNode из tree.xml
if(rs==null)
{
//sendError('fnGetData==null!');
}else
{
try {
while (rs.next()) //while (row = res->fetch(PDO::FETCH_ASSOC))
{
String fid="";
String iid="";
String val="";
if(DBTools.hasColumn(rs,"id")) fid=rs.getString("id"); else fid=""; //Уникальный id записи
if(DBTools.hasColumn(rs,"icon_id")) iid=rs.getString("icon_id"); else iid=""; //id значка
if(DBTools.hasColumn(rs,caption)) val=rs.getString(caption); else val=""; //Заголовок
String visible = "";
if(tmpNode.getAttributes().getNamedItem("visible").getNodeValue().equals("0")) visible=" visible=\"0\" ";
//Для проверки есть ли дети составляем XML запрос и отправляем в вункцию как будто он пришел от клиента
//c - Есть ли под узлы по умолчанию есть
//fid - id записи
//iid - id иконки
//treeid - id ветки дерева
//ObjectID - название поля с уникальным идентификатором записи
String xmlnode = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
xmlnode+="<tree c=\"1\" fid=\""+fid+"\" iid=\""+iid+"\" treeid=\""+treeid+"\" t=\""+tmpNode.getAttributes().getNamedItem("n").getNodeValue()+"\" ObjectID=\""+tmpNode.getAttributes().getNamedItem("ObjectID").getNodeValue()+"\""+visible+">";
xmlnode+="<![CDATA["+val+"]]>";
//сохраняем параметры фильтра для дочерних элементов с текщем состоянием
//перебираем фильтры которые должны быть заполненны для каждого узла даные для фильтра беруться из результ сета
xmlnode+="<columns>";
//считываем название поля и находим данные в результсете
Node nodeParam = XMLTools.findFirstNode(tmpNode, "columns"); //tree.xml
if(nodeParam!=null) nodeParam=nodeParam.getFirstChild();
while (nodeParam != null)
{
if(nodeParam.getNodeName().equals("param"))
{
String fname = nodeParam.getAttributes().getNamedItem("n").getNodeValue();
String fval="";
try
{
if(DBTools.hasColumn(rs,fname))
{
fval=rs.getString(fname);
}else
{ fval=XMLTools.getCDATAValue(nodeParam);
}
} catch (Exception e)
{
//sendError(e->getMessage());
}
xmlnode+="<param n=\""+fname+"\"><![CDATA["+fval+"]]></param>";
}
nodeParam = nodeParam.getNextSibling();
}
xmlnode+="</columns>";
xmlnode+="</tree>";
//парсим созданную ветку дерева в DOMDocument потом посылаем в функцию взятия данных как будто их все открыли
//если есть данные то у этого узла дерева есть дети c="1" инече нет c="0".
int child = 0;
Document objXMLDocTree=null;
try
{ //objXMLDocTree->loadXML(xmlnode);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
objXMLDocument = dBuilder.parse(xmlnode);
} catch (Exception e)
{ //sendError(e->getMessage());
}
Element testNodeTree = objXMLDocTree.getDocumentElement();
Node testNode = tmpNode.getFirstChild(); //Текущий узел из tree.xml
while (testNode != null)
{
Node tmpNode2 = testNode;
if(tmpNode2.getNodeName().equals("goto"))
{
treeid=tmpNode2.getAttributes().getNamedItem("id").getNodeValue();
tmpNode2=XMLTools.findFirstNodeOnAttribute(objXMLDocument.getDocumentElement(),"type","id",treeid);
if(tmpNode2==null) { testNode = testNode.getNextSibling(); continue; }
}
if(tmpNode2.getNodeName().equals("type"))
{
/*Object testrs = fnGetData(conn,testNodeTree,tmpNode2);
if((testrs!=null)&&(testrs.rowCount()>0))
{
child=1;
break;
}*/
}
testNode = testNode.getNextSibling();
}
//testNodeTree.getAttribute("c",child);
//retrez+=objXMLDocTree->saveXML(objXMLDocTree.getDocumentElement());
//Закончили проверку на детей
}
} catch (DOMException | SQLException e) {
e.printStackTrace();
}
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
currNode = currNode.getNextSibling();
}
}else
{
result="<metadata fn=\"-1\"><![CDATA[Not find find id=\""+treeid+"\"!]]></metadata>";
}
result="<?xml version=\"1.0\" encoding=\"utf-8\"?><metadata fn=\"1\" htmlid=\""+htmlid+"\">"+retrez+"</metadata>";
//header('Content-type: text/xml');
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
//return body content
return result;
}
//Replace all the values of the first filter values from the second
public void setFilter(Node n1, Node n2) {
if (n1 == null || n2 == null)
return;
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
Node nc1 = n1.getFirstChild();
while (nc1 != null) {
if (nc1.getNodeName().equals("column")) {
try {
String path = "column[@n='" + nc1.getAttributes().getNamedItem("n").getNodeValue() + "']";
XPathExpression expr = xpath.compile(path);
NodeList nodeList = (NodeList) expr.evaluate(n2, XPathConstants.NODESET);
if (nodeList.getLength() > 0) {
Node nc2 = nodeList.item(0);
XMLTools.setCharacterDataToElement((Element) nc1, XMLTools.getCharacterDataFromElement((Element) nc2));
//getCdata($nc1)->nodeValue=getCdata($nc2)->nodeValue;
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
//String message = "XML parsing error!";
//return;
}
}
nc1 = nc1.getNextSibling();
}
}
public ResultSet fnGetData(Connection conn,Node treeNode,Node currNode)
{
String sql=getSQL(treeNode,currNode);
/*if(gettype($_SESSION['USER_ID'])=='string')
sql=str_replace('${_user_id}',$_SESSION['USER_ID']=='' ? 'null' : '\''.$_SESSION['USER_ID'].'\'',$sql);
else
sql=str_replace('${_user_id}',$_SESSION['USER_ID']=='' ? 'null' : $_SESSION['USER_ID'],$sql);*/
Statement stmt;
ResultSet rs=null;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
}
/** Перенести параметры из родительского в sql строку дочернего элемента
* @param XMLNode $nParent Родительский узел
* @param XMLNode $nChild Дочерний узел
* @result Строка
*/
public String getSQL(Node nParent,Node nChild)
{
if(nChild==null) return "";
String sql="";
Node nPs=XMLTools.findNode(nParent, "columns");
Node nFs=XMLTools.findNode(nChild, "filter");
//Переносим значения в фильтр
if(nFs!=null)
{
Node nP;
if(nPs!=null) nP=nPs.getFirstChild(); else nP=null;
while (nP != null)
{
if (nP.getNodeName().equals("param"))
{
String val=XMLTools.getCDATAValue(nP);
Node nF=XMLTools.findNodeOnAttribute(nFs, "column", "pn", nP.getAttributes().getNamedItem("n").getNodeValue());
if(nF!=null)
XMLTools.setCharacterDataToElement(nF, val);
}
nP = nP.getNextSibling();
}
}
//Переносим значения в SQL запрос из фильтра
sql=XMLTools.getCDATAValue(XMLTools.findNode(nChild,"sql-query"));
nFs=XMLTools.findNode(nChild, "filter");
if(nFs!=null)
{ Node nF = nFs.getFirstChild();
while(nF != null)
{
if(nF.getNodeName().equals("column"))
{
sql = sql.replace("{"+nF.getAttributes().getNamedItem("n").getNodeValue()+"}", DBTools.getSQLValue(nF.getAttributes().getNamedItem("vt").getNodeValue(),XMLTools.getCDATAValue(nF)));
}
nF=nF.getNextSibling();
}
}
return sql;
}
@Override
public void setServletContext(ServletContext servletContext) {
this.context=servletContext;
}
}

View File

@ -73,33 +73,6 @@ class EdtRec
} }
}; };
//Функция для создания или редактирования новой записи (аналог callData)
//Если id = -1 то это создание новой записи
eRecNa(typeName,id,settings)
{
this.f_TypeName=typeName;
this.f_Settings=settings;
this.record_id=id;
postXMLData(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+typeName+'"></type></metadata>',
(ok,data)=>{
if(ok){
if(data.error_code=='0')
{
this.eRecNo(data,this.record_id);
}else
{
alert2(trt('Alert'),data.error_message);
}
}else{
alert2(trt('Error'),data);
}
this.hideProgressBar();
}
);
this.showProgressBar();
};
//Задать CDATA значение для узла "type->properties->prop" по "n" //Задать CDATA значение для узла "type->properties->prop" по "n"
setPropCdata(name,value) setPropCdata(name,value)
{ {
@ -138,6 +111,33 @@ class EdtRec
} }
}; };
//Функция для создания или редактирования новой записи (аналог callData)
//Если id = -1 то это создание новой записи
eRecNa(typeName,id,settings)
{
this.f_TypeName=typeName;
this.f_Settings=settings;
this.record_id=id;
postXMLData(ScriptDBMS+"metadata",'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+typeName+'"></type></metadata>',
(ok,data)=>{
if(ok){
if(data.error_code=='0')
{
this.eRecNo(data,this.record_id);
}else
{
alert2(trt('Alert'),data.error_message);
}
}else{
alert2(trt('Error'),data);
}
this.hideProgressBar();
}
);
this.showProgressBar();
};
// Create a user GUI from XML () // Create a user GUI from XML ()
// Node - Node "type" // Node - Node "type"
eRecNo(Node,record_id) eRecNo(Node,record_id)

View File

@ -38,7 +38,7 @@ class DBMSUser
{ {
if(findNode(node,'#cdata-section').nodeValue=="0") //if not logged if(findNode(node,'#cdata-section').nodeValue=="0") //if not logged
{ {
this.showLoginForm(); //this.showLoginForm();
}else }else
{ {
this.name=getCdataValue(findNode(node,'name')); this.name=getCdataValue(findNode(node,'name'));
@ -86,7 +86,7 @@ class DBMSUser
}; };
//Display login and registration form //Display login and registration form
showLoginForm() /*showLoginForm()
{ {
if(this.win==null || this.win.closed) if(this.win==null || this.win.closed)
{ {
@ -152,17 +152,18 @@ class DBMSUser
}; };
} }
} }
}; };*/
//logout current user //logout current user
Logout() /*Logout()
{ {
xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[1]]></cmd></metadata>'; let xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[1]]></cmd></metadata>';
var request=new TRequest(this); let request=new TRequest(this);
if(request.callServer(ScriptName,xs)) if(request.callServer(ScriptName,xs))
{ {
this.showShadow(); this.showShadow();
} }
}; };*/
showLock(visible) { showLock(visible) {
if(this.divsh==null) { if(this.divsh==null) {
@ -177,7 +178,7 @@ class DBMSUser
} }
//Checking the session without its extension, if it is completed, we display the authorization window. //Checking the session without its extension, if it is completed, we display the authorization window.
checkSession() /*checkSession()
{ {
$.ajax({ $.ajax({
url: '../session', url: '../session',
@ -205,7 +206,7 @@ class DBMSUser
} }
}); });
setTimeout(()=>this.checkSession(), 10000); setTimeout(()=>this.checkSession(), 10000);
}; };*/
showShadow(visible) showShadow(visible)
{ {

View File

@ -1579,7 +1579,11 @@ class SRec
let erec = new EdtRec(""); let erec = new EdtRec("");
erec.win.setParent(this.win); erec.win.setParent(this.win);
erec.opener=this; erec.opener=this;
erec.eRecNo(this.nodeMetadata,id);
if(findNodeOnPath(this.nodeMetadata, 'type/properties')!=null)
erec.eRecNo(this.nodeMetadata,id);
else
erec.eRecNa(this.f_TypeName,id,null);
//e.win.setLeftTop(pageX-10,pageY-10); //e.win.setLeftTop(pageX-10,pageY-10);
if(this.onInsert!=null) this.onUpdate(erec); if(this.onInsert!=null) this.onUpdate(erec);
@ -1601,7 +1605,11 @@ class SRec
let erec = new EdtRec(""); let erec = new EdtRec("");
erec.win.setParent(this.win); erec.win.setParent(this.win);
erec.opener=this; erec.opener=this;
erec.eRecNo(this.nodeMetadata,id); //alert("2 "+findNodeOnPath(this.nodeMetadata, 'type/properties'));
if(findNodeOnPath(this.nodeMetadata, 'type/properties')!=null)
erec.eRecNo(this.nodeMetadata,id);
else
erec.eRecNa(this.f_TypeName,id,null);
//e.win.setLeftTop(pageX-10,pageY-10); //e.win.setLeftTop(pageX-10,pageY-10);
if(this.onInsert!=null) this.onUpdate(erec); if(this.onInsert!=null) this.onUpdate(erec);
@ -1668,7 +1676,7 @@ class SRec
{ {
this.f_TypeName=typeName; this.f_TypeName=typeName;
this.f_Settings=settings; this.f_Settings=settings;
postXMLData(ScriptName,'<metadata fn="0"><type n="'+this.f_TypeName+'"></type></metadata>',(ok,data)=>{ postXMLData(ScriptDBMS+"metadata",'<metadata fn="0"><type n="'+this.f_TypeName+'"></type></metadata>',(ok,data)=>{
if(ok){ if(ok){
if(data.error_code=='0') if(data.error_code=='0')
{ {

View File

@ -265,7 +265,7 @@ function postJsonData(url,data,fun){
{ {
return function(){ return function(){
if(req.readyState == 4 || typeof(req.readyState)=='undefined'){ if(req.readyState == 4 || typeof(req.readyState)=='undefined'){
if(req.status == 200) { //if(req.status == 200) {
if(req.responseXML!=null) { if(req.responseXML!=null) {
let node = req.responseXML.documentElement; let node = req.responseXML.documentElement;
node.error_code='0'; node.error_code='0';
@ -281,9 +281,9 @@ function postJsonData(url,data,fun){
else else
fun(false, req.responseText); fun(false, req.responseText);
} }
}else{ //}else{
fun(false,trt('Failed_to_receive_data')); // fun(false,trt('Failed_to_receive_data'));
} //}
} }
}; };
}(req); }(req);
@ -327,8 +327,30 @@ function postXMLData(url,data,fun){
req.open( "POST", url, true ); req.open( "POST", url, true );
req.setRequestHeader("Content-type", "application/xml"); req.setRequestHeader("Content-type", "application/xml");
req.send(data); req.send(data);
}
function errorDialog(data,okFunc){
if(data!=null && data !== undefined && data.error_message !== undefined && data.error_message!=null){
if(typeof data.error_message === "string"){
alert2(trt('Alert'), trt(data.error_message), '', okFunc);
}else if(Array.isArray(data.error_message)){
let text = '';
for(let i=0;i<data.error_message.length;i++){
let word = data.error_message[i];
if(Array.isArray(data.error_setting)){
let keys = data.error_setting[i];
if (keys != null || keys != undefined) {
keys = keys.split(";")
word = vsprintf(trt(word), keys);
}
}
text += trt(word) + "<br>\n";
}
alert2(trt('Alert'), text, '', okFunc);
}
}else{
alert2(trt('Alert'), trt('Error_while_receiving_data'), data, okFunc);
}
} }
//Вывести текст поверх окон с кнопочкой OK //Вывести текст поверх окон с кнопочкой OK
@ -407,7 +429,7 @@ function confirm2(title,smallText,fullText,okFunc,cancelFunc)
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">`+fullText+`</td> <td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">`+fullText+`</td>
</tr> </tr>
<tr style="height: 10px;"> <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>')+`&nbsp;</td> <td style="width: 100%;">`+(fullText === undefined || fullText == null || fullText == '' ? '' : '<label><input type="checkbox" id="show_'+win.uid+'" name="scales"> '+trt('Full_text')+'</label>')+`&nbsp;</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+`_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> <td><button class="button-secondary" id="`+win.uid+`_cancel" style="width: 80px;margin:1px;">`+trt('Cancel')+`</button></td>
</tr> </tr>
@ -1312,64 +1334,6 @@ class TRequest
return null; return null;
} }
/*processReqChange(xmlHttpRequest,url,xmlString)
{
//if (typeof(xmlHttpRequest.readyState)=='undefined' || xmlHttpRequest.readyState == 4)
//{
if(typeof(xmlHttpRequest.status)=='undefined' || xmlHttpRequest.status == 200)
{
alert(JSON.stringify(xmlHttpRequest));
if(typeof(xmlHttpRequest.responseXML)=='undefined') {
if(xmlHttpRequest.contentType.match(/\/xml/)) {
xmlHttpRequest.responseXML = CreateXMLDOC(xmlHttpRequest.responseText);
if(xmlHttpRequest.responseXML==null) {
alert2(trt('Alert'), trt('Wrong_XML_document') + "!\nXML=(" + xmlHttpRequest.responseText + ')\nURL=(' + url + ')\nxmlString=(' + xmlString + ')');
return;
}
//загрузился xml документ начинаем его разбирать (по id функции в документе)
let node = xmlHttpRequest.responseXML.documentElement;
if((node==null)||(node.getAttribute("fn")==null)) alert(trt('Error')+"\n"+trt('No_data')+"!\n"+xmlHttpRequest.responseText);
else
{
let fn = node.getAttribute("fn");
if(this.winObj!=null)
{
this.winObj.applyReq(this,fn,node,xmldoc,this.winObj);
return null;
}else if(fn==0) alert(findFirstNode(node,'#cdata-section').nodeValue);
}
}else if(xmlHttpRequest.contentType.match(/\/json/)){
xmlHttpRequest.responseXML = JSON.parse(xmlHttpRequest.responseText);
if(xmlHttpRequest.responseXML==null) {
alert2(trt('Alert'), trt('Wrong_JSON_document') + "!\nJSON=(" + xmlHttpRequest.responseText + ')\nURL=(' + url + ')\njsonString=(' + xmlString + ')');
return;
}
//загрузился xml документ начинаем его разбирать (по id функции в документе)
let node=xmlHttpRequest.responseXML;
if((node==null)||(node.fn==null)) alert(trt('Error')+"\n"+trt('No_data')+"!\n"+xmlHttpRequest.responseText);
else
{
if(this.winObj!=null)
{
this.winObj.applyReq(this,node.fn,node,null,this.winObj);
return null;
}else if(fn==0) alert(findFirstNode(node,'#cdata-section').nodeValue);
}
}
}
}else
{
if(confirm(trt('Failed_to_get_data')+"\n URL: "+url+"\n"+xmlHttpRequest.statusText+"\nПовторить запрос?"))
{
this.callServer(url,xmlString);
};
}
//}
return null;
}*/
}; };
/** Класс асинхронных запросов к серверу (TODO удалить его и не использовать) /** Класс асинхронных запросов к серверу (TODO удалить его и не использовать)

View File

@ -253,17 +253,26 @@ class TWin
obj.appendChild(val); obj.appendChild(val);
} }
//Присвоить содержимое в виде строки //Присвоить содержимое
setContent(html) setContent(html)
{ {
let obj=document.getElementById('TWin_Co_'+this.tWinId); let obj=document.getElementById('TWin_Co_'+this.tWinId);
if(obj!=null) if(obj!=null)
{ {
obj.innerHTML=html; obj.innerHTML = '';
if (html instanceof HTMLElement || html instanceof DocumentFragment) {
obj.appendChild(html);
} else if (typeof html === 'string') {
obj.innerHTML = html; //TODO не использовать
} else {
console.warn('setContent: unsupported data type passed', html);
return;
}
if(this.tbl.offsetHeight>this.div.offsetHeight) this.div.style.height=this.tbl.offsetHeight+"px"; 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"; if(this.tbl.offsetWidth>this.div.offsetWidth) this.div.style.width=this.tbl.offsetWidth+"px";
} }
} }
//Выбрать (активизировать) окно //Выбрать (активизировать) окно
setSel() setSel()
{ {
@ -388,7 +397,7 @@ class TWin
r.setRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate"); r.setRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate");
r.setRequestHeader("Pragma", "no-cache"); r.setRequestHeader("Pragma", "no-cache");
r.setRequestHeader("Expires", "0"); r.setRequestHeader("Expires", "0");
if(json!=null) if(json!=null){
r.send(JSON.stringify(json)); r.send(JSON.stringify(json));
}else { }else {
r.open( "GET", url, true ); r.open( "GET", url, true );
@ -427,17 +436,25 @@ class TWin
w.childs[w.childs.length]=this; w.childs[w.childs.length]=this;
} }
} }
hide(val)
{ get visible() {
if(val) return this.div.style.display!=='none';
{ this.div.style.display='none'; }
this.divsh.style.display='none';
}else set visible(val){
{ if(val){
this.div.style.display='inline'; this.div.style.display='inline';
if(this.shadow) this.divsh.style.display='block'; if(this.shadow) this.divsh.style.display='block';
}else
{
this.div.style.display='none';
this.divsh.style.display='none';
} }
} }
hide(val)//TODO Outdated
{
this.visible=!val;
}
//Показать прогрес бар //Показать прогрес бар
showProgressBar() showProgressBar()

View File

@ -43,7 +43,7 @@
<table> <table>
<tr> <tr>
<td valign="top" style="width: 30em;"> <td valign="top" style="width: 30em;">
<h1><a href="http://www.dynarch.com/projects/calendar/">The new coolest JavaScript calendar</a></h1> <h1><a href=""></a></h1>
<div id="cont"></div> <div id="cont"></div>
<script> <script>
var LEFT_CAL = Calendar.setup({ var LEFT_CAL = Calendar.setup({
@ -56,7 +56,7 @@
</script> </script>
<p> <p>
<a href="http://www.dynarch.com/projects/calendar/doc/">Extensive API documentation is available at www.dynarch.com</a> <a href=""></a>
</p> </p>
<p> <p>

View File

@ -9,7 +9,6 @@
</head> </head>
<body> <body>
<table class="SEdit" id="app0" border="0px" cellspacing="1" cellpadding="1" style="width: 100%; height: 100%;"> <table class="SEdit" id="app0" border="0px" cellspacing="1" cellpadding="1" style="width: 100%; height: 100%;">
<caption><b id="caption'+this.uid+'"></b></caption> <caption><b id="caption'+this.uid+'"></b></caption>
<thead> <thead>

View File

@ -1,6 +1,6 @@
<?php <?php
require_once("../../config.xyz"); require_once("../../config.xyz");
require_once("../include/xmltools.php"); require_once("../include/xmltools.xyz");
$treexml='tree.xml'; $treexml='tree.xml';
require_once("tree.php"); require_once("tree.php");
?> ?>

View File

@ -9053,8 +9053,8 @@
devtools.emit('init', Vue); devtools.emit('init', Vue);
} else { } else {
console[console.info ? 'info' : 'log']( console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' + '' +
'https://github.com/vuejs/vue-devtools' ''
); );
} }
} }
@ -9062,9 +9062,9 @@
typeof console !== 'undefined' typeof console !== 'undefined'
) { ) {
console[console.info ? 'info' : 'log']( console[console.info ? 'info' : 'log'](
"You are running Vue in development mode.\n" + "" +
"Make sure to turn on production mode when deploying for production.\n" + "" +
"See more tips at https://vuejs.org/guide/deployment.html" ""
); );
} }
}, 0); }, 0);