Compare commits
19 Commits
975d9ee310
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4de2104d11 | |||
| 4c0d652787 | |||
| cb2146cb7a | |||
| 2b019380c2 | |||
| e7a712af02 | |||
| 65fe6498cd | |||
| ddcb146952 | |||
| 6155890816 | |||
| afbf168bd8 | |||
| 91e8b21d39 | |||
| ec85845d9e | |||
| 5a6b47e788 | |||
| 5cca3481c4 | |||
| 9d0332d2ee | |||
| 8952eb375d | |||
| d9e5677a8c | |||
| 0b5903938c | |||
| 21df97b853 | |||
| 93650e9d1a |
File diff suppressed because it is too large
Load Diff
@ -1,458 +0,0 @@
|
|||||||
package kz.goodssales.GoodsSales.dbms;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
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 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 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.User;
|
|
||||||
import tools.XMLTools;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@SessionAttributes( { "user" }) //Сесионный объект!
|
|
||||||
public class DBMSTree implements ServletContextAware {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(kz.goodssales.GoodsSales.dbms.DBMSTree.class);
|
|
||||||
private ServletContext context;
|
|
||||||
|
|
||||||
//If not created object "user", create him.
|
|
||||||
@ModelAttribute("user")
|
|
||||||
public User populatePerson() {
|
|
||||||
return new User("none");
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 = "";
|
|
||||||
|
|
||||||
//Load DB configuration from "config.xml"
|
|
||||||
try {
|
|
||||||
//String fullPath = context.getRealPath("/WEB-INF/config.xml");
|
|
||||||
//File fXmlFile = new File(fullPath);
|
|
||||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
|
||||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
|
||||||
//Document doc = dBuilder.parse(fXmlFile);
|
|
||||||
Document doc = dBuilder.parse(new ClassPathResource("config.xml").getInputStream());
|
|
||||||
Element nMain = doc.getDocumentElement();
|
|
||||||
NodeList nl = nMain.getChildNodes();
|
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
|
||||||
if (nl.item(i).getNodeName().equals("db-url"))
|
|
||||||
db_url = nl.item(i).getTextContent();
|
|
||||||
if (nl.item(i).getNodeName().equals("db-login"))
|
|
||||||
db_login = nl.item(i).getTextContent();
|
|
||||||
if (nl.item(i).getNodeName().equals("db-password"))
|
|
||||||
db_password = nl.item(i).getTextContent();
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
logger.info(ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
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() + "}", Tools.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(Tools.hasColumn(rs,"id")) fid=rs.getString("id"); else fid=""; //Уникальный id записи
|
|
||||||
if(Tools.hasColumn(rs,"icon_id")) iid=rs.getString("icon_id"); else iid=""; //id значка
|
|
||||||
if(Tools.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(Tools.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()+"}", Tools.getSQLValue(nF.getAttributes().getNamedItem("vt").getNodeValue(),XMLTools.getCDATAValue(nF)));
|
|
||||||
}
|
|
||||||
nF=nF.getNextSibling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sql;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setServletContext(ServletContext servletContext) {
|
|
||||||
this.context=servletContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
if(!isset($_SESSION['USER_ID'])) { $_SESSION['USER_ID']=null; }
|
if(!isset($_SESSION['USER_ID'])) { $_SESSION['USER_ID']=null; }
|
||||||
if(!isset($_COOKIE['GUID'])) { $_COOKIE['GUID']=null; }
|
if(!isset($_COOKIE['GUID'])) { $_COOKIE['GUID']=null; }
|
||||||
|
|
||||||
//include("../include/xmltools.php");
|
//include("../include/xmltools.xyz");
|
||||||
//include("../include/toExcell.php");
|
//include("../include/toExcell.php");
|
||||||
//require_once("config.xyz");
|
//require_once("config.xyz");
|
||||||
|
|
||||||
@ -272,7 +272,7 @@
|
|||||||
$allow_ins=false;
|
$allow_ins=false;
|
||||||
$allow_upd=false;
|
$allow_upd=false;
|
||||||
$allow_del=false;
|
$allow_del=false;
|
||||||
$sql_query='select '.$Schema.'p_getaccess(:user_id1,:action_insert) as ins,'.$Schema.'p_getaccess(:user_id2,:action_update) as upd,'.$Schema.'p_getaccess(:user_id3,:action_delete) as del;';
|
$sql_query='select '.$Schema.'get_access(:user_id1,:action_insert) as ins,'.$Schema.'get_access(:user_id2,:action_update) as upd,'.$Schema.'get_access(:user_id3,:action_delete) as del;';
|
||||||
$stmt = $db->prepare($sql_query);
|
$stmt = $db->prepare($sql_query);
|
||||||
$stmt->bindValue(':user_id1', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
$stmt->bindValue(':user_id1', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
||||||
$stmt->bindValue(':user_id2', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
$stmt->bindValue(':user_id2', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
||||||
@ -1038,7 +1038,7 @@
|
|||||||
echo $xs;
|
echo $xs;
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
}elseif ($cmd==3) //Авторизация по логину и паролю
|
}elseif ($cmd==3) //Авторизация по логину и паролю (везде где используется JWT этот код не нужен)
|
||||||
{
|
{
|
||||||
//По идентификатору выбираем информацию о пользователе
|
//По идентификатору выбираем информацию о пользователе
|
||||||
$ans='0';
|
$ans='0';
|
||||||
@ -1247,12 +1247,12 @@
|
|||||||
fwrite($fh, ' <caption><b>'.findNode($currNode,'objects-list')->getAttribute("d").'</b></caption>'."\n");
|
fwrite($fh, ' <caption><b>'.findNode($currNode,'objects-list')->getAttribute("d").'</b></caption>'."\n");
|
||||||
fwrite($fh, ' <thead>'."\n");
|
fwrite($fh, ' <thead>'."\n");
|
||||||
fwrite($fh, ' <tr>');
|
fwrite($fh, ' <tr>');
|
||||||
fwrite($fh, '<td bgcolor="#d1d1d1">№</td>');
|
fwrite($fh, '<td style="background-color:#d1d1d1;">№</td>');
|
||||||
$nextnode=findNode($currNode,'objects-list')->firstChild;
|
$nextnode=findNode($currNode,'objects-list')->firstChild;
|
||||||
$col=0;
|
$col=0;
|
||||||
while ($nextnode)
|
while ($nextnode)
|
||||||
{ if ($nextnode->nodeName=='column')
|
{ if ($nextnode->nodeName=='column')
|
||||||
{ fwrite($fh, '<td bgcolor="#d1d1d1" width="'.$nextnode->getAttribute("width").'px"><b>'.$nextnode->getAttribute("d")."</b></td>");
|
{ fwrite($fh, '<td style="background-color:#d1d1d1;" width="'.$nextnode->getAttribute("width").'px"><b>'.$nextnode->getAttribute("d")."</b></td>");
|
||||||
}
|
}
|
||||||
$nextnode = $nextnode->nextSibling;
|
$nextnode = $nextnode->nextSibling;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1343,7 @@
|
|||||||
print ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
print ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||||
print ' </head>';
|
print ' </head>';
|
||||||
print ' <body>';
|
print ' <body>';
|
||||||
print ' <form name="form" enctype="multipart/form-data" action="records.php?fn=9" method="post">';
|
print ' <form name="form" enctype="multipart/form-data" action="/api/dbms/v09/upload" method="post">';
|
||||||
print ' <input type="hidden" name="state" value=""/>';
|
print ' <input type="hidden" name="state" value=""/>';
|
||||||
print ' <input type="file" name="file"><br/>';
|
print ' <input type="file" name="file"><br/>';
|
||||||
print ' <input type="submit" value="Send File">';
|
print ' <input type="submit" value="Send File">';
|
||||||
|
|||||||
@ -36,8 +36,6 @@ class EdtRec
|
|||||||
this.pBarCnt=0; //Progress Bar
|
this.pBarCnt=0; //Progress Bar
|
||||||
this.pBarDiv=null; //Progress Bar
|
this.pBarDiv=null; //Progress Bar
|
||||||
|
|
||||||
this.request = new TRequest(this);
|
|
||||||
|
|
||||||
//this.fields = new Array();
|
//this.fields = new Array();
|
||||||
|
|
||||||
ERec_mas[this.uid]=this;
|
ERec_mas[this.uid]=this;
|
||||||
@ -75,19 +73,6 @@ class EdtRec
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Функция для создания или редактирования новой записи (аналог callData)
|
|
||||||
//Если id = -1 то это создание новой записи
|
|
||||||
eRecNa(typeName,id,settings)
|
|
||||||
{
|
|
||||||
this.f_TypeName=typeName;
|
|
||||||
this.f_Settings=settings;
|
|
||||||
this.record_id=id;
|
|
||||||
if(this.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+typeName+'"></type></metadata>'))
|
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//Задать CDATA значение для узла "type->properties->prop" по "n"
|
//Задать CDATA значение для узла "type->properties->prop" по "n"
|
||||||
setPropCdata(name,value)
|
setPropCdata(name,value)
|
||||||
{
|
{
|
||||||
@ -126,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)
|
||||||
@ -140,17 +152,17 @@ class EdtRec
|
|||||||
//Записываю record_id в соответствующее XML поле
|
//Записываю record_id в соответствующее XML поле
|
||||||
this.setPropCdata(nodeType.getAttribute("ObjectID"),record_id);
|
this.setPropCdata(nodeType.getAttribute("ObjectID"),record_id);
|
||||||
|
|
||||||
let str='';
|
let str=`
|
||||||
str+=' <table class="SEdit" id="eTable'+this.uid+'" border="0px" cellspacing="1" cellpadding="1" style="width: 100%; height: 100%;">';
|
<table class="SEdit" id="eTable`+this.uid+`" border="0px" cellspacing="1" cellpadding="1" style="width: 100%; height: 100%;">
|
||||||
str+=' <caption><b id="caption'+this.uid+'"></b></caption>';
|
<caption><b id="caption`+this.uid+`"></b></caption>
|
||||||
str+=' <thead>';
|
<thead>
|
||||||
str+=' <tr bgcolor="#dadada">';
|
<tr style="background-color:#dadada;">
|
||||||
str+=' <th style="width:20%">'+trt('Name')+'</th>';
|
<th style="width:20%">`+trt('Name')+`</th>
|
||||||
str+=' <th style="width:80%">'+trt('Value')+'</th>';
|
<th style="width:80%">`+trt('Value')+`</th>
|
||||||
str+=' </tr>';
|
</tr>
|
||||||
str+=' </thead>';
|
</thead>
|
||||||
str+=' <tbody></tbody>';
|
<tbody></tbody>
|
||||||
str+=' </table>';
|
</table>`;
|
||||||
document.getElementById('eDiv'+this.uid).innerHTML=str;
|
document.getElementById('eDiv'+this.uid).innerHTML=str;
|
||||||
//this.win.setContent(str);
|
//this.win.setContent(str);
|
||||||
|
|
||||||
@ -236,13 +248,8 @@ class EdtRec
|
|||||||
}
|
}
|
||||||
nP=nP.nextSibling;
|
nP=nP.nextSibling;
|
||||||
}
|
}
|
||||||
subSRec.f_Settings=nodeProp;
|
|
||||||
|
|
||||||
subSRec.f_State='0';
|
subSRec.f_State='0';
|
||||||
if(subSRec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+nodeProp.getAttribute("n")+'"></type></metadata>'))
|
subSRec.callData(nodeProp.getAttribute("n"),nodeProp);
|
||||||
{
|
|
||||||
//obj.showProgressBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
}else
|
}else
|
||||||
if (nodeProp.nodeName=="divide") //Grouping fields.
|
if (nodeProp.nodeName=="divide") //Grouping fields.
|
||||||
@ -673,7 +680,7 @@ class EdtRec
|
|||||||
}else
|
}else
|
||||||
if(vt==="blob" || vt==="file")
|
if(vt==="blob" || vt==="file")
|
||||||
{
|
{
|
||||||
let ifr=createIFrame("prop_"+this.uid+"_"+nodeProp.getAttribute("n")+'_frm', ScriptUName+"?fn=9", td2, false); //IFrame to send the file to the server.
|
let ifr=createIFrame("prop_"+this.uid+"_"+nodeProp.getAttribute("n")+'_frm', ScriptUName, td2, false); //IFrame to send the file to the server.
|
||||||
document.body.appendChild(ifr);
|
document.body.appendChild(ifr);
|
||||||
|
|
||||||
let tbl_b=document.createElement('table');
|
let tbl_b=document.createElement('table');
|
||||||
@ -865,10 +872,21 @@ class EdtRec
|
|||||||
this.fillGUIFromXML();
|
this.fillGUIFromXML();
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
if(this.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="5"><type id="'+this.record_id+'" n="'+type_name+'" ObjectID="'+nodeType.getAttribute("ObjectID")+'"></type></metadata>',true))
|
postXMLData(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="5"><type id="'+this.record_id+'" n="'+type_name+'" ObjectID="'+nodeType.getAttribute("ObjectID")+'"></type></metadata>',(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setData(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -914,11 +932,26 @@ class EdtRec
|
|||||||
let option=document.getElementById("prop_"+this.uid+"_"+node.getAttribute("n"));
|
let option=document.getElementById("prop_"+this.uid+"_"+node.getAttribute("n"));
|
||||||
setCdataValue(node,0,option.value);
|
setCdataValue(node,0,option.value);
|
||||||
|
|
||||||
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
postXMLData(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>',(ok,data)=>{
|
||||||
if(this.request.callServer(ScriptName,strXMLF,true))
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
|
||||||
|
//if(this.request.callServer(ScriptName,strXMLF,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -935,7 +968,7 @@ class EdtRec
|
|||||||
let win=new TWin();
|
let win=new TWin();
|
||||||
win.BuildGUI(pageX-10,pageY-10);
|
win.BuildGUI(pageX-10,pageY-10);
|
||||||
let str=`
|
let str=`
|
||||||
<table id="thetable`+win+`" bgcolor="SlateGrey" style="border: 1px solid rgb(99, 99, 99);" width="100%">
|
<table id="thetable`+win+`" style="background-color:SlateGrey;border: 1px solid rgb(99, 99, 99);" width="100%">
|
||||||
<caption></caption>
|
<caption></caption>
|
||||||
<thead><tr><th></th></tr></thead>
|
<thead><tr><th></th></tr></thead>
|
||||||
<tbody><tr><td></td></tr></tbody>
|
<tbody><tr><td></td></tr></tbody>
|
||||||
@ -988,14 +1021,9 @@ class EdtRec
|
|||||||
rec.create(null);
|
rec.create(null);
|
||||||
rec.f_State=1;
|
rec.f_State=1;
|
||||||
rec.f_PropName=nodeProp.getAttribute("n");
|
rec.f_PropName=nodeProp.getAttribute("n");
|
||||||
rec.f_Settings=settings;
|
|
||||||
rec.f_TypeName=TypeName;
|
|
||||||
rec.win.setLeftTop(pageX-250,pageY-10);
|
rec.win.setLeftTop(pageX-250,pageY-10);
|
||||||
rec.win.setParent(this.win);
|
rec.win.setParent(this.win);
|
||||||
if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+TypeName+'"></type></metadata>'))
|
rec.callData(TypeName,settings)
|
||||||
{
|
|
||||||
rec.showProgressBar();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Запросить данные для выпадающих списков и других объектов (только после загрузки данных полей)
|
//Запросить данные для выпадающих списков и других объектов (только после загрузки данных полей)
|
||||||
@ -1029,18 +1057,46 @@ class EdtRec
|
|||||||
}
|
}
|
||||||
nColF = nColF.nextSibling;
|
nColF = nColF.nextSibling;
|
||||||
}
|
}
|
||||||
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
postXMLData(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>',(ok,data)=>{
|
||||||
if(this.request.callServer(ScriptName,strXMLF,true))
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setDataSelect(data);
|
||||||
}
|
|
||||||
}else
|
}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>';
|
alert2(trt('Alert'),data.error_message);
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
//if(this.request.callServer(ScriptName,strXMLF,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
postXMLData(ScriptName,'<?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>',(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
|
{
|
||||||
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
//if(this.request.callServer(ScriptName,xml,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@ -1168,7 +1224,7 @@ class EdtRec
|
|||||||
}else
|
}else
|
||||||
if(count>1) //Display the item selection window.
|
if(count>1) //Display the item selection window.
|
||||||
{
|
{
|
||||||
let htmlString='<table width="100%" bgcolor="whitesmoke">';
|
let htmlString='<table width="100%" style="background-color:whitesmoke;">';
|
||||||
nodeProp=nodeType.firstChild;
|
nodeProp=nodeType.firstChild;
|
||||||
let i=0;
|
let i=0;
|
||||||
while (nodeProp!=null)
|
while (nodeProp!=null)
|
||||||
@ -1182,7 +1238,7 @@ class EdtRec
|
|||||||
value=value.replace(/"/g, """);
|
value=value.replace(/"/g, """);
|
||||||
value=value.replace(/'/g, "\\'");
|
value=value.replace(/'/g, "\\'");
|
||||||
value=value.replace(/\n/g, " ");
|
value=value.replace(/\n/g, " ");
|
||||||
htmlString+='<tr><td bgColor="'+bgColor+'" onClick="setPropVal('+this.uid+',\''+id+'\',\''+value+'\',\''+prop_name+'\');" style="cursor: pointer;">'+findFirstNode(nodeProp, '#cdata-section').nodeValue+'</td></tr>'+"\n";
|
htmlString+='<tr><td onClick="setPropVal('+this.uid+',\''+id+'\',\''+value+'\',\''+prop_name+'\');" style="background-color:"'+bgColor+'";cursor: pointer;">'+findFirstNode(nodeProp, '#cdata-section').nodeValue+'</td></tr>'+"\n";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
nodeProp=nodeProp.nextSibling;
|
nodeProp=nodeProp.nextSibling;
|
||||||
@ -1199,39 +1255,6 @@ class EdtRec
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
applyReq(req,fn,node,xmldoc,win)
|
|
||||||
{
|
|
||||||
this.hideProgressBar();
|
|
||||||
|
|
||||||
if(node.error_code>0) {
|
|
||||||
alert2(trt('Alert'), node.error_message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fn==0) {
|
|
||||||
this.eRecNo(node,this.record_id);
|
|
||||||
} else
|
|
||||||
if (fn==1) { //returned id
|
|
||||||
this.insertRows(node);
|
|
||||||
} else
|
|
||||||
if (fn==2) { //Returned id and type of updated record
|
|
||||||
this.updateRows(node);
|
|
||||||
} else
|
|
||||||
if (fn==3) { //Returned id of deleted record
|
|
||||||
this.deleteRows(node);
|
|
||||||
} else
|
|
||||||
if (fn==5) {
|
|
||||||
this.setData(node);
|
|
||||||
} else
|
|
||||||
if (fn==6) { //Fill in the drop-down lists.
|
|
||||||
this.setDataSelect(node);
|
|
||||||
} else
|
|
||||||
if (fn==7) {
|
|
||||||
this.setData(node);
|
|
||||||
} else {
|
|
||||||
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* Request data to fill in the field with the button
|
* Request data to fill in the field with the button
|
||||||
*
|
*
|
||||||
@ -1267,10 +1290,25 @@ class EdtRec
|
|||||||
'</type></metadata>';
|
'</type></metadata>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
postXMLData(ScriptName,xml,(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
//if(this.request.callServer(ScriptName,xml,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
alert2(trt('Alert'),'Field "'+prop_id+'" not find!');
|
alert2(trt('Alert'),'Field "'+prop_id+'" not find!');
|
||||||
@ -1291,10 +1329,25 @@ class EdtRec
|
|||||||
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'"><objects-list><filter>';
|
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'"><objects-list><filter>';
|
||||||
xml+='<column n="'+filterName+'"><![CDATA['+value+']]></column>';
|
xml+='<column n="'+filterName+'"><![CDATA['+value+']]></column>';
|
||||||
xml+='</filter></objects-list></type></metadata>';
|
xml+='</filter></objects-list></type></metadata>';
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
postXMLData(ScriptName,xml,(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
//if(this.request.callServer(ScriptName,xml,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1377,10 +1430,25 @@ class EdtRec
|
|||||||
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")+'" id="'+value+'">';
|
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")+'" id="'+value+'">';
|
||||||
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
|
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
|
||||||
xml+='</type></metadata>';
|
xml+='</type></metadata>';
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
postXMLData(ScriptName,xml,(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
//if(this.request.callServer(ScriptName,xml,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1459,11 +1527,41 @@ class EdtRec
|
|||||||
s+=' </properties>\n';
|
s+=' </properties>\n';
|
||||||
s+='</type>\n';
|
s+='</type>\n';
|
||||||
s+='</metadata>';
|
s+='</metadata>';
|
||||||
//alert2(trt('Alert'),s);
|
|
||||||
if(this.request.callServer(ScriptName,s,true))
|
if (this.record_id!=-1) {
|
||||||
{
|
postXMLData(ScriptName, s, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == '0') {
|
||||||
|
this.updateRows(data);
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), data.error_message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Error'), data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
this.showProgressBar();
|
||||||
|
}else{
|
||||||
|
postXMLData(ScriptName, s, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == '0') {
|
||||||
|
this.insertRows(data);
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), data.error_message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Error'), data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if(this.request.callServer(ScriptName,s,true))
|
||||||
|
//{
|
||||||
|
// this.showProgressBar();
|
||||||
|
//}
|
||||||
};
|
};
|
||||||
//Check the field according to its type
|
//Check the field according to its type
|
||||||
checkData(value,type,maybenull)
|
checkData(value,type,maybenull)
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
@ -223,27 +224,25 @@ class DBMSUser
|
|||||||
//Функция запрашивает информацию о текущем пользователе с сервера
|
//Функция запрашивает информацию о текущем пользователе с сервера
|
||||||
LoadData()
|
LoadData()
|
||||||
{
|
{
|
||||||
var r = new TRequest(this);
|
let r = new TRequest(this);
|
||||||
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
let xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||||
if(r.callServer(ScriptName,xs))
|
if(r.callServer(ScriptName,xs))
|
||||||
{
|
{
|
||||||
this.showShadow(true);
|
this.showShadow(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//Check whether the already authorized (+ attempt to log in through "hash").
|
//Check whether the already authorized (+ attempt to log in through "hash").
|
||||||
isLogined()
|
/*isLogined()
|
||||||
{
|
{
|
||||||
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
let xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||||
var request=new TRequest(this);
|
let request=new TRequest(this);
|
||||||
if(request.callServer(ScriptName,xs))
|
if(request.callServer(ScriptName,xs))
|
||||||
{
|
{
|
||||||
this.showShadow(true);
|
this.showShadow(true);
|
||||||
|
|
||||||
alert(ScriptName+" = "+xs);
|
alert(ScriptName+" = "+xs);
|
||||||
|
|
||||||
//m_winPP.showProgressBar();
|
//m_winPP.showProgressBar();
|
||||||
}
|
}
|
||||||
};
|
};*/
|
||||||
|
|
||||||
addListener(l)
|
addListener(l)
|
||||||
{ if(l.OnLogin==null) alert('Object does not have the function "OnLogin()"!');
|
{ if(l.OnLogin==null) alert('Object does not have the function "OnLogin()"!');
|
||||||
|
|||||||
@ -8,19 +8,24 @@
|
|||||||
$host = '.'.cutAfterLast($host,'.',2);
|
$host = '.'.cutAfterLast($host,'.',2);
|
||||||
ini_set('session.cookie_domain', $host);
|
ini_set('session.cookie_domain', $host);
|
||||||
|
|
||||||
//if(isset($_GET[session_name()]) && $_GET[session_name()]!='') //Чтоб сессия переданная гетом была главней
|
//Сессию не убирать! (Если что нужно без сессии то этот файл следует разбить на части!)
|
||||||
// session_id($_GET[session_name()]);
|
//@session_start(['cookie_lifetime' => 43200,'cookie_secure' => true,'cookie_httponly' => true]);
|
||||||
|
|
||||||
startSession(true); //Для ручного определения времени жизни сесии
|
startSession(true); //Для ручного определения времени жизни сесии
|
||||||
|
|
||||||
|
$language_id=1;
|
||||||
|
if(filter_has_var(INPUT_COOKIE, 'lng'))
|
||||||
|
{
|
||||||
|
$language_id=filter_input(INPUT_COOKIE, 'lng', FILTER_VALIDATE_INT);
|
||||||
|
if($_COOKIE["lng"]=='ru') $language_id=1;
|
||||||
|
if($_COOKIE["lng"]=='kz' || $_COOKIE["lng"]=='kk') $language_id=2;
|
||||||
|
if($_COOKIE["lng"]=='en') $language_id=3;
|
||||||
|
if($_COOKIE["lng"]=='uz') $language_id=4;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_SESSION['REMOTE_ADDR']) && $_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) unset($_SESSION['USER_ID']); //Делаемся не авторизованным если зашли с другого ip адреса
|
if(isset($_SESSION['REMOTE_ADDR']) && $_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) unset($_SESSION['USER_ID']); //Делаемся не авторизованным если зашли с другого ip адреса
|
||||||
if(!isset($_SESSION['USER_ID'])) { $_SESSION['USER_ID']=null; }
|
if(!isset($_SESSION['USER_ID'])) { $_SESSION['USER_ID']=null; }
|
||||||
if(!isset($_COOKIE['GUID'])) { $_COOKIE['GUID']=null; }
|
if(!isset($_COOKIE['GUID'])) { $_COOKIE['GUID']=null; }
|
||||||
|
|
||||||
//include("../include/xmltools.php");
|
|
||||||
//include("../include/toExcell.php");
|
|
||||||
//require_once("config.xyz");
|
|
||||||
|
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
$path = dirname($_SERVER['PHP_SELF']);
|
$path = dirname($_SERVER['PHP_SELF']);
|
||||||
$position = strrpos($path,'/') + 1;
|
$position = strrpos($path,'/') + 1;
|
||||||
@ -223,6 +228,7 @@
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
if(!isset($fn))
|
||||||
$fn=filter_input(INPUT_GET, 'fn', FILTER_VALIDATE_INT, array('options'=>array('default'=>-1)));
|
$fn=filter_input(INPUT_GET, 'fn', FILTER_VALIDATE_INT, array('options'=>array('default'=>-1)));
|
||||||
|
|
||||||
$HTTP_INPUT=file_get_contents("php://input");
|
$HTTP_INPUT=file_get_contents("php://input");
|
||||||
@ -240,7 +246,7 @@
|
|||||||
|
|
||||||
if ($reqNode)
|
if ($reqNode)
|
||||||
{
|
{
|
||||||
$fn = $reqNode->getAttribute("fn"); //Номер функции
|
$fn = $reqNode->getAttribute("fn"); //Номер функции из XML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +278,7 @@
|
|||||||
$allow_ins=false;
|
$allow_ins=false;
|
||||||
$allow_upd=false;
|
$allow_upd=false;
|
||||||
$allow_del=false;
|
$allow_del=false;
|
||||||
$sql_query='select '.$Schema.'p_getaccess(:user_id1,:action_insert) as ins,'.$Schema.'p_getaccess(:user_id2,:action_update) as upd,'.$Schema.'p_getaccess(:user_id3,:action_delete) as del;';
|
$sql_query='select '.$Schema.'get_access(:user_id1,:action_insert) as ins,'.$Schema.'get_access(:user_id2,:action_update) as upd,'.$Schema.'get_access(:user_id3,:action_delete) as del;';
|
||||||
$stmt = $db->prepare($sql_query);
|
$stmt = $db->prepare($sql_query);
|
||||||
$stmt->bindValue(':user_id1', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
$stmt->bindValue(':user_id1', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
||||||
$stmt->bindValue(':user_id2', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
$stmt->bindValue(':user_id2', $_SESSION['USER_ID'], PDO::PARAM_INT); //getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID'])
|
||||||
@ -924,7 +930,7 @@
|
|||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
echo $xmlstring;
|
echo $xmlstring;
|
||||||
}else
|
}else
|
||||||
if ($fn==7)//Залогинеться
|
if ($fn==7)//Залогинеться (TODO логин происходит через JWT в другом коде на java)
|
||||||
{
|
{
|
||||||
$cmd=getCdataValue(findFirstNode($reqNode,"cmd"));
|
$cmd=getCdataValue(findFirstNode($reqNode,"cmd"));
|
||||||
$login=getCdataValue(findFirstNode($reqNode,"login"));
|
$login=getCdataValue(findFirstNode($reqNode,"login"));
|
||||||
@ -1028,7 +1034,7 @@
|
|||||||
$xs.=' <patronymic><![CDATA['.$row['patronymic'].']]></patronymic>'."\n";
|
$xs.=' <patronymic><![CDATA['.$row['patronymic'].']]></patronymic>'."\n";
|
||||||
$xs.=' <company_id><![CDATA['.$row['company_id'].']]></company_id>'."\n";
|
$xs.=' <company_id><![CDATA['.$row['company_id'].']]></company_id>'."\n";
|
||||||
$xs.=' <expiration><![CDATA['.$row['expiration'].']]></expiration>'."\n";
|
$xs.=' <expiration><![CDATA['.$row['expiration'].']]></expiration>'."\n";
|
||||||
$xs.=' <overdue><![CDATA['.$row['overdue'].']]></overdue>'."\n";
|
//$xs.=' <overdue><![CDATA['.$row['overdue'].']]></overdue>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$xs.='</metadata>';
|
$xs.='</metadata>';
|
||||||
@ -1252,7 +1258,7 @@
|
|||||||
$col=0;
|
$col=0;
|
||||||
while ($nextnode)
|
while ($nextnode)
|
||||||
{ if ($nextnode->nodeName=='column')
|
{ if ($nextnode->nodeName=='column')
|
||||||
{ fwrite($fh, '<td bgcolor="#d1d1d1" width="'.$nextnode->getAttribute("width").'px"><b>'.$nextnode->getAttribute("d")."</b></td>");
|
{ fwrite($fh, '<td style="background-color:#d1d1d1;" width="'.$nextnode->getAttribute("width").'px"><b>'.$nextnode->getAttribute("d")."</b></td>");
|
||||||
}
|
}
|
||||||
$nextnode = $nextnode->nextSibling;
|
$nextnode = $nextnode->nextSibling;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1349,7 @@
|
|||||||
print ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
print ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||||
print ' </head>';
|
print ' </head>';
|
||||||
print ' <body>';
|
print ' <body>';
|
||||||
print ' <form name="form" enctype="multipart/form-data" action="records.php?fn=9" method="post">';
|
print ' <form name="form" enctype="multipart/form-data" action="/api/dbms/v09/upload" method="post">';
|
||||||
print ' <input type="hidden" name="state" value=""/>';
|
print ' <input type="hidden" name="state" value=""/>';
|
||||||
print ' <input type="file" name="file"><br/>';
|
print ' <input type="file" name="file"><br/>';
|
||||||
print ' <input type="submit" value="Send File">';
|
print ' <input type="submit" value="Send File">';
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
//http://leopard.in.ua/2008/09/20/otslezhivanie-istecheniya-sroka-dejstviya-sessij/
|
//http://leopard.in.ua/2008/09/20/otslezhivanie-istecheniya-sroka-dejstviya-sessij/
|
||||||
//session_save_path('C:\ses');
|
//session_save_path('C:\ses');
|
||||||
|
|
||||||
require_once("../include/tools.php");
|
require_once("../include/tools.xyz");
|
||||||
|
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
$host = '.'.cutAfterLast($host,'.',2);
|
$host = '.'.cutAfterLast($host,'.',2);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
//var ScriptName='../records'; //POST
|
//var ScriptName='../api/dbms/v09/records.xyz'; //POST
|
||||||
//var ScriptDName='../download';
|
//var ScriptDName='../download';
|
||||||
//var ScriptUName='../upload';
|
//var ScriptUName='../upload';
|
||||||
//var ScriptRName='../reports'; //GET For download reports (?file=name)
|
//var ScriptRName='/api/dbms/v09/reports'; //GET For download reports (?file=name)
|
||||||
//var ScriptSName='../session';
|
//var ScriptSName='../session';
|
||||||
|
|||||||
@ -31,7 +31,6 @@ class SRec
|
|||||||
this.masCL=new Array();//node table column
|
this.masCL=new Array();//node table column
|
||||||
this.masVis=new Array(); //Whether to display a column
|
this.masVis=new Array(); //Whether to display a column
|
||||||
this.masChBox=new Array(); //Checkboxes
|
this.masChBox=new Array(); //Checkboxes
|
||||||
this.xmldoc=null; //accepted XML document (for CDATA creation)
|
|
||||||
this.pagepos=0; //current data page
|
this.pagepos=0; //current data page
|
||||||
|
|
||||||
this.pBarCnt=0; //Progress bar
|
this.pBarCnt=0; //Progress bar
|
||||||
@ -40,57 +39,12 @@ class SRec
|
|||||||
this.name="";
|
this.name="";
|
||||||
|
|
||||||
this.uid=getUID();
|
this.uid=getUID();
|
||||||
this.request = new TRequest(this);
|
|
||||||
SRec_mas[this.uid]=this;
|
SRec_mas[this.uid]=this;
|
||||||
|
|
||||||
this.onUpdate=null; //For call set function
|
this.onUpdate=null; //For call set function
|
||||||
this.onInsert=null; //For call set function
|
this.onInsert=null; //For call set function
|
||||||
}
|
}
|
||||||
|
|
||||||
applyReq(req,fn,node,xmldoc)
|
|
||||||
{
|
|
||||||
this.hideProgressBar();
|
|
||||||
|
|
||||||
if(node.error_code>0) {
|
|
||||||
alert2(trt('Alert'), node.error_message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.xmldoc=node.ownerDocument; //xmldoc;
|
|
||||||
|
|
||||||
if (fn==0)
|
|
||||||
{
|
|
||||||
//alert2(trt('Alert'),getXMLNodeSerialisation(node));
|
|
||||||
this.setMetadata(node);
|
|
||||||
this.updateSize();
|
|
||||||
}else
|
|
||||||
if (fn==11) //Update record after editing, 1 entry has come.
|
|
||||||
{
|
|
||||||
this.updateRows(node);
|
|
||||||
}else
|
|
||||||
if (fn==3) //Information which record or records were deleted.
|
|
||||||
{
|
|
||||||
this.ApplyDelRec(node);
|
|
||||||
}else
|
|
||||||
if (fn==4) //Data after the selection of records, replacement of existing ones.
|
|
||||||
{
|
|
||||||
this.insertRows(node,true);
|
|
||||||
}else
|
|
||||||
if (fn==6) //Fill in the drop-down lists.
|
|
||||||
{
|
|
||||||
this.setDataSelect(node);
|
|
||||||
}else
|
|
||||||
if (fn==8) //There was a link to the report.
|
|
||||||
{
|
|
||||||
if(this.rwin!=null)
|
|
||||||
{
|
|
||||||
this.rwin.hideProgressBar();
|
|
||||||
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: var(--back-color-1);"><tr><td align="center"><a href="'+ScriptRName+(ScriptRName.indexOf('?')!=-1 ? '&file=' : '?file=')+findFirstNode(node,'#cdata-section').nodeValue+'" target="_blank">'+trt('Download_report')+': "'+this.win.getCaption().innerHTML+'".</a></td></tr></table>');
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Edit the GUI filter from the xml string.
|
//Edit the GUI filter from the xml string.
|
||||||
setGUISettings(xmlStr)
|
setGUISettings(xmlStr)
|
||||||
{
|
{
|
||||||
@ -166,7 +120,7 @@ class SRec
|
|||||||
<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>
|
<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>
|
</table>
|
||||||
</td></tr><tr><td id="tblContainer_`+this.uid+`" style="vertical-align:top; overflow:hidden; width:100%; height:100%; text-align:center;">
|
</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;">
|
<div id="tblSContainer_`+this.uid+`" style="background-color: var(--back-color2); position: absolute; overflow:scroll; width: 400px; height: 400px;">
|
||||||
<table id="thetable`+this.uid+`" class="SShow">
|
<table id="thetable`+this.uid+`" class="SShow">
|
||||||
<caption></caption>
|
<caption></caption>
|
||||||
<thead><tr><th></th></tr></thead>
|
<thead><tr><th></th></tr></thead>
|
||||||
@ -360,7 +314,8 @@ class SRec
|
|||||||
id=nodeProp.getAttribute("id");
|
id=nodeProp.getAttribute("id");
|
||||||
value=getCdataValue(nodeProp);
|
value=getCdataValue(nodeProp);
|
||||||
value=value.replace(/"/g, """); value=value.replace(/'/g, "\\'");
|
value=value.replace(/"/g, """); value=value.replace(/'/g, "\\'");
|
||||||
htmlString+='<tr><td bgColor="'+bgColor+'" onClick="setFilterVal('+this.uid+',\''+id+'\',\''+value+'\',\''+prop_id+'\')" style="cursor: pointer;">'+findFirstNode(nodeProp, '#cdata-section').nodeValue+' </td></tr>'+"\n";
|
|
||||||
|
htmlString+='<tr><td onClick="setFilterVal('+this.uid+',\''+id+'\',\''+value+'\',\''+prop_id+'\')" style="cursor:pointer;background-color:'+bgColor+';">'+findFirstNode(nodeProp, '#cdata-section').nodeValue+' </td></tr>'+"\n";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
nodeProp=nodeProp.nextSibling;
|
nodeProp=nodeProp.nextSibling;
|
||||||
@ -429,11 +384,7 @@ class SRec
|
|||||||
'<objects-list><filter><column n="id"><![CDATA[' + id + ']]></column></filter></objects-list>' +
|
'<objects-list><filter><column n="id"><![CDATA[' + id + ']]></column></filter></objects-list>' +
|
||||||
'</type></metadata>';
|
'</type></metadata>';
|
||||||
}
|
}
|
||||||
|
this.callDataSelect(xml);
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
alert2(trt('Alert'),'Filter "'+column_n+'" not find!');
|
alert2(trt('Alert'),'Filter "'+column_n+'" not find!');
|
||||||
@ -511,12 +462,34 @@ class SRec
|
|||||||
xs+='</filter></objects-list></type>\n';
|
xs+='</filter></objects-list></type>\n';
|
||||||
xs+='</metadata>';
|
xs+='</metadata>';
|
||||||
|
|
||||||
//alert2(trt('Alert'),xs);
|
if(id!=-1) {
|
||||||
|
postXMLData(ScriptName, xs, (ok, data) => {
|
||||||
if(this.request.callServer(ScriptName,xs))
|
if (ok) {
|
||||||
{
|
if (data.error_code == '0') {
|
||||||
this.showProgressBar();
|
this.updateRows(data);
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), data.error_message);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Error'), data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
postXMLData(ScriptName, xs, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == '0') {
|
||||||
|
this.insertRows(data, true);
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), data.error_message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Error'), data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get metadata records and break them into global variables.
|
//Get metadata records and break them into global variables.
|
||||||
@ -531,6 +504,7 @@ class SRec
|
|||||||
let tablefilter=document.getElementById('idfilter'+this.uid);
|
let tablefilter=document.getElementById('idfilter'+this.uid);
|
||||||
if (tablefilter==null || tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
|
if (tablefilter==null || tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
|
||||||
let nodeType=findFirstNode(node, "type");
|
let nodeType=findFirstNode(node, "type");
|
||||||
|
if (nodeType==null) alert2(trt('Alert'),'Not_find_data');
|
||||||
this.f_pI=nodeType.getAttribute("ins");//access rights
|
this.f_pI=nodeType.getAttribute("ins");//access rights
|
||||||
this.f_pU=nodeType.getAttribute("upd");
|
this.f_pU=nodeType.getAttribute("upd");
|
||||||
this.f_pD=nodeType.getAttribute("del");
|
this.f_pD=nodeType.getAttribute("del");
|
||||||
@ -889,17 +863,10 @@ class SRec
|
|||||||
nColF = nColF.nextSibling;
|
nColF = nColF.nextSibling;
|
||||||
}
|
}
|
||||||
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
||||||
|
this.callDataSelect(strXMLF);
|
||||||
if(this.request.callServer(ScriptName,strXMLF,true))
|
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
if(this.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+object+'" c="'+fc+'" pn="'+columnNode.getAttribute("n")+'" fn="'+columnNode.getAttribute("n")+'"></type></metadata>',true))
|
this.callDataSelect('<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+object+'" c="'+fc+'" pn="'+columnNode.getAttribute("n")+'" fn="'+columnNode.getAttribute("n")+'"></type></metadata>');
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@ -944,10 +911,7 @@ class SRec
|
|||||||
if ((value!="")&&(value!=-1))
|
if ((value!="")&&(value!=-1))
|
||||||
{
|
{
|
||||||
let xmlString='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+columnNode.getAttribute("object")+'" c="'+columnNode.getAttribute("FieldCaption")+'" pn="'+columnNode.getAttribute("n")+'" fn="'+columnNode.getAttribute("n")+'"><objects-list><filter><column n="id"><![CDATA['+value+']]></column></filter></objects-list></type></metadata>';
|
let xmlString='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+columnNode.getAttribute("object")+'" c="'+columnNode.getAttribute("FieldCaption")+'" pn="'+columnNode.getAttribute("n")+'" fn="'+columnNode.getAttribute("n")+'"><objects-list><filter><column n="id"><![CDATA['+value+']]></column></filter></objects-list></type></metadata>';
|
||||||
if(this.request.callServer(ScriptName,xmlString,true))
|
this.callDataSelect(xmlString);
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td2.appendChild( table );
|
td2.appendChild( table );
|
||||||
@ -1053,10 +1017,7 @@ class SRec
|
|||||||
}
|
}
|
||||||
|
|
||||||
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
strXMLF='<?xml version="1.0" encoding="utf-8"?><metadata fn="6">'+strXMLF+'</metadata>';
|
||||||
if(this.request.callServer(ScriptName,strXMLF,true))
|
this.callDataSelect(strXMLF);
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1065,6 +1026,26 @@ class SRec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callDataSelect(data) {
|
||||||
|
postXMLData(ScriptName,data,
|
||||||
|
(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
|
{
|
||||||
|
this.setDataSelect(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.showProgressBar();
|
||||||
|
}
|
||||||
|
|
||||||
//We ask the server for a list of values almost like a drop-down list.
|
//We ask the server for a list of values almost like a drop-down list.
|
||||||
//typeName - The name of the object (TODO if the current is the variable f TypeName)
|
//typeName - The name of the object (TODO if the current is the variable f TypeName)
|
||||||
//name - the name of the column for selecting the values (must match the name of any filter in typeName)
|
//name - the name of the column for selecting the values (must match the name of any filter in typeName)
|
||||||
@ -1078,10 +1059,7 @@ class SRec
|
|||||||
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'" id="'+id+'"><objects-list><filter>';
|
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+typeName+'" c="'+name+'" pn="'+htmlid+'" id="'+id+'"><objects-list><filter>';
|
||||||
xml+='<column n="'+filterName+'"><![CDATA['+value+']]></column>';
|
xml+='<column n="'+filterName+'"><![CDATA['+value+']]></column>';
|
||||||
xml+='</filter></objects-list></type></metadata>';
|
xml+='</filter></objects-list></type></metadata>';
|
||||||
if(this.request.callServer(ScriptName,xml,true))
|
this.callDataSelect(xml);
|
||||||
{
|
|
||||||
this.showProgressBar();
|
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
document.getElementById("filter_"+this.uid+"_"+htmlid).value='';
|
document.getElementById("filter_"+this.uid+"_"+htmlid).value='';
|
||||||
@ -1280,8 +1258,8 @@ class SRec
|
|||||||
if(node.data[i].row[j]!=null) textNode=document.createTextNode(node.data[i].row[j]);
|
if(node.data[i].row[j]!=null) textNode=document.createTextNode(node.data[i].row[j]);
|
||||||
else textNode=document.createTextNode("");
|
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.setAttribute("id",id+this.masCL[colN].n); //so that you can identify each record when you update
|
||||||
td.appendChild(textNode);
|
td.appendChild(textNode);
|
||||||
//if in the metadata for this column there is a reference object then add a link
|
//if in the metadata for this column there is a reference object then add a link
|
||||||
if (this.masCT[colN]!=null)
|
if (this.masCT[colN]!=null)
|
||||||
@ -1296,9 +1274,9 @@ class SRec
|
|||||||
};
|
};
|
||||||
//when you click on a cell, the sent filter is prefilled with variables in accordance with the id of the pressed line
|
//when you click on a cell, the sent filter is prefilled with variables in accordance with the id of the pressed line
|
||||||
//in the function we pass the cell id and the column number
|
//in the function we pass the cell id and the column number
|
||||||
td.onclick=function(obj,val1,val2){
|
td.onclick=function(thiz,val1,val2){
|
||||||
return function(){
|
return function(){
|
||||||
obj.callWindow(val1,val2);
|
thiz.callWindow(val1,val2);
|
||||||
}
|
}
|
||||||
}(this,id,colN);
|
}(this,id,colN);
|
||||||
}else
|
}else
|
||||||
@ -1400,14 +1378,9 @@ class SRec
|
|||||||
rec.create(null);
|
rec.create(null);
|
||||||
rec.f_State=1; //Зачем коментил?
|
rec.f_State=1; //Зачем коментил?
|
||||||
rec.f_PropName=nodeColu.getAttribute("n"); //Зачем коментил?
|
rec.f_PropName=nodeColu.getAttribute("n"); //Зачем коментил?
|
||||||
rec.f_Settings=settings;
|
|
||||||
rec.f_TypeName=TypeName;
|
|
||||||
rec.win.setLeftTop(pageX-250,pageY-10);
|
rec.win.setLeftTop(pageX-250,pageY-10);
|
||||||
rec.win.setParent(this.win);
|
rec.win.setParent(this.win);
|
||||||
if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+TypeName+'"></type></metadata>'))
|
rec.callData(TypeName,settings);
|
||||||
{
|
|
||||||
rec.showProgressBar();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
//Call the ShowRecord window with the parameters for the filter (not just the object name)
|
//Call the ShowRecord window with the parameters for the filter (not just the object name)
|
||||||
//id - id records from the database
|
//id - id records from the database
|
||||||
@ -1431,16 +1404,9 @@ class SRec
|
|||||||
//wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
|
//wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
|
||||||
let rec=new SRec();
|
let rec=new SRec();
|
||||||
rec.create(null);
|
rec.create(null);
|
||||||
//rec.f_State=1; not used
|
|
||||||
//rec.f_PropName=propname; not used
|
|
||||||
rec.f_Settings=xmlString;
|
|
||||||
rec.f_TypeName=typeName;
|
|
||||||
rec.win.setLeftTop(pageX-250,pageY-10);
|
rec.win.setLeftTop(pageX-250,pageY-10);
|
||||||
rec.win.setParent(this.win);
|
rec.win.setParent(this.win);
|
||||||
if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+rec.f_TypeName+'"></type></metadata>'))
|
rec.callData(typeName,xmlString);
|
||||||
{
|
|
||||||
rec.showProgressBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get column number by name
|
//Get column number by name
|
||||||
@ -1453,10 +1419,10 @@ class SRec
|
|||||||
{
|
{
|
||||||
if(nodeCol.nodeName=="column")
|
if(nodeCol.nodeName=="column")
|
||||||
{
|
{
|
||||||
|
i++;
|
||||||
if(nodeCol.getAttribute("n")==name){
|
if(nodeCol.getAttribute("n")==name){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
nodeCol = nodeCol.nextSibling;
|
nodeCol = nodeCol.nextSibling;
|
||||||
}
|
}
|
||||||
@ -1565,10 +1531,28 @@ class SRec
|
|||||||
xs+=' </filter></objects-list>\n';
|
xs+=' </filter></objects-list>\n';
|
||||||
xs+=' </type>\n';
|
xs+=' </type>\n';
|
||||||
xs+='</metadata>';
|
xs+='</metadata>';
|
||||||
if(this.request.callServer(ScriptName,xs))
|
|
||||||
|
postXMLData(ScriptName,xs,
|
||||||
|
(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.rwin.showProgressBar();
|
if(this.rwin!=null)
|
||||||
|
{
|
||||||
|
this.rwin.hideProgressBar();
|
||||||
|
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: var(--back-color-1);"><tr><td align="center"><a href="'+ScriptRName+(ScriptRName.indexOf('?')!=-1 ? '&file=' : '?file=')+findFirstNode(data,'#cdata-section').nodeValue+'" target="_blank">'+trt('Download_report')+': "'+this.win.getCaption().innerHTML+'".</a></td></tr></table>');
|
||||||
}
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
chp(page)
|
chp(page)
|
||||||
@ -1595,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;
|
||||||
|
|
||||||
|
if(findNodeOnPath(this.nodeMetadata, 'type/properties')!=null)
|
||||||
erec.eRecNo(this.nodeMetadata,id);
|
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);
|
||||||
@ -1617,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;
|
||||||
|
//alert("2 "+findNodeOnPath(this.nodeMetadata, 'type/properties'));
|
||||||
|
if(findNodeOnPath(this.nodeMetadata, 'type/properties')!=null)
|
||||||
erec.eRecNo(this.nodeMetadata,id);
|
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);
|
||||||
@ -1638,10 +1630,23 @@ class SRec
|
|||||||
{
|
{
|
||||||
if(this.masChBox[i].checked)
|
if(this.masChBox[i].checked)
|
||||||
{
|
{
|
||||||
if(this.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="3"><type n="'+this.f_TypeName+'" id="'+this.masChBox[i].value+'"></type></metadata>',true))
|
postXMLData(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="3"><type n="'+this.f_TypeName+'" id="'+this.masChBox[i].value+'"></type></metadata>',
|
||||||
|
(ok,data)=>{
|
||||||
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.ApplyDelRec(data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1671,15 +1676,25 @@ class SRec
|
|||||||
{
|
{
|
||||||
this.f_TypeName=typeName;
|
this.f_TypeName=typeName;
|
||||||
this.f_Settings=settings;
|
this.f_Settings=settings;
|
||||||
|
postXMLData(ScriptDBMS+"metadata",'<metadata fn="0"><type n="'+this.f_TypeName+'"></type></metadata>',(ok,data)=>{
|
||||||
if(this.request.callServer(ScriptName,'<metadata fn="0"><type n="'+this.f_TypeName+'"></type></metadata>'))
|
if(ok){
|
||||||
|
if(data.error_code=='0')
|
||||||
{
|
{
|
||||||
|
this.setMetadata(data);
|
||||||
|
this.updateSize();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Alert'),data.error_message);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Error'),data);
|
||||||
|
}
|
||||||
|
this.hideProgressBar();
|
||||||
|
});
|
||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Convert XML to array
|
//Convert XML to array
|
||||||
function nodeToTable(node)
|
function nodeToTable(node)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,14 +1,29 @@
|
|||||||
/*jshint esversion: 6 */
|
/*jshint esversion: 6 */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
//var g_translations = {'':''};
|
function strToInt(str){
|
||||||
|
if(str==null) return null;
|
||||||
|
const match = str.trim().match(/[-+]?\d+(\.\d+)?/);
|
||||||
|
if (match) {
|
||||||
|
const number = Number(match[0]);
|
||||||
|
return isNaN(number) ? null : number;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeChild(parent){
|
||||||
|
if(parent==null) return;
|
||||||
|
while (parent.firstChild) {
|
||||||
|
parent.removeChild(parent.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Массив g_translations подгружается отдельно
|
//Массив g_translations подгружается отдельно
|
||||||
function trt(key)
|
function trt(key)
|
||||||
{
|
{
|
||||||
if(key==null || key===undefined) return '';
|
if(key==null || key===undefined) return '';
|
||||||
let val=null;
|
let val=null;
|
||||||
if(g_translations !== undefined){
|
if(typeof g_translations !== 'undefined'){
|
||||||
val=g_translations[key];
|
val=g_translations[key];
|
||||||
if(val==null || val===undefined)
|
if(val==null || val===undefined)
|
||||||
{
|
{
|
||||||
@ -21,7 +36,10 @@ function trt(key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(val==null || val===undefined) return (''+key).replace(/_/g, ' ');
|
if(val==null || val===undefined) {
|
||||||
|
|
||||||
|
return ('' + key).replace(/_/g, ' ');
|
||||||
|
}
|
||||||
else return val;
|
else return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +255,21 @@ function loadContent(url,obj)
|
|||||||
req.send( null );
|
req.send( null );
|
||||||
}
|
}
|
||||||
|
|
||||||
//POST Json Data to server and Json in result
|
|
||||||
|
function getJsonData(url, callback) {
|
||||||
|
fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error("Error HTTP: " + response.status);
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => callback(data))
|
||||||
|
.catch(error => console.error("Fetch error:", error));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//POST Json Data to server
|
||||||
function postJsonData(url,data,fun){
|
function postJsonData(url,data,fun){
|
||||||
if(typeof data !== 'string') {
|
if(typeof data !== 'string') {
|
||||||
data = JSON.stringify(data);
|
data = JSON.stringify(data);
|
||||||
@ -247,7 +279,12 @@ 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) {
|
||||||
|
let node = req.responseXML.documentElement;
|
||||||
|
node.error_code='0';
|
||||||
|
fun(true, node);
|
||||||
|
}else {
|
||||||
let json = null;
|
let json = null;
|
||||||
try {
|
try {
|
||||||
json = JSON.parse(req.responseText);
|
json = JSON.parse(req.responseText);
|
||||||
@ -257,9 +294,10 @@ function postJsonData(url,data,fun){
|
|||||||
fun(true, json);
|
fun(true, json);
|
||||||
else
|
else
|
||||||
fun(false, req.responseText);
|
fun(false, req.responseText);
|
||||||
}else{
|
|
||||||
fun(false,trt('Failed_to_receive_data'));
|
|
||||||
}
|
}
|
||||||
|
//}else{
|
||||||
|
// fun(false,trt('Failed_to_receive_data'));
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}(req);
|
}(req);
|
||||||
@ -268,16 +306,82 @@ function postJsonData(url,data,fun){
|
|||||||
req.send(data);
|
req.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//POST Json Data to server
|
||||||
|
function postXMLData(url,data,fun){
|
||||||
|
if(typeof data !== 'string') {
|
||||||
|
let serializer = new XMLSerializer();
|
||||||
|
data = serializer.serializeToString(data);
|
||||||
|
}
|
||||||
|
let req=createRequestObject();
|
||||||
|
req.onreadystatechange = function(req)
|
||||||
|
{
|
||||||
|
return function(){
|
||||||
|
if(req.readyState == 4 || typeof(req.readyState)=='undefined'){
|
||||||
|
if(req.status == 200) {
|
||||||
|
if(req.responseXML!=null) {
|
||||||
|
let node = req.responseXML.documentElement;
|
||||||
|
node.error_code='0';
|
||||||
|
fun(true, node);
|
||||||
|
}else {
|
||||||
|
let json = null;
|
||||||
|
try {
|
||||||
|
json = JSON.parse(req.responseText);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
if (json != null)
|
||||||
|
fun(true, json);
|
||||||
|
else
|
||||||
|
fun(false, req.responseText);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
fun(false,trt('Failed_to_receive_data'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(req);
|
||||||
|
req.open( "POST", url, true );
|
||||||
|
req.setRequestHeader("Content-type", "application/xml");
|
||||||
|
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
|
||||||
function alert2(title,smallText,fullText,okFunc=null)
|
function alert2(title,smallText,fullText,okFunc=null)
|
||||||
{
|
{
|
||||||
|
if(fullText === undefined) fullText='';
|
||||||
if(smallText === undefined || smallText==''){
|
if(smallText === undefined || smallText==''){
|
||||||
smallText=fullText;
|
smallText=fullText;
|
||||||
fullText='';
|
fullText='';
|
||||||
}
|
}
|
||||||
let pos1=smallText.indexOf('[[');
|
let pos1=smallText.indexOf('[[');
|
||||||
let pos2=smallText.indexOf(']]');
|
let pos2=smallText.indexOf(']]');
|
||||||
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=smallText.substring(pos1+2, pos2);
|
if(pos1>=0 && pos2>=0 && pos1<pos2) {
|
||||||
|
fullText = smallText;
|
||||||
|
smallText = smallText.substring(pos1 + 2, pos2);
|
||||||
|
}
|
||||||
|
|
||||||
let win=new TWin(true);
|
let win=new TWin(true);
|
||||||
win.BuildGUI(10,10);
|
win.BuildGUI(10,10);
|
||||||
@ -340,7 +444,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>')+` </td>
|
<td style="width: 100%;">`+(fullText === undefined || fullText == null || 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+`_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>
|
||||||
@ -1245,67 +1349,9 @@ 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 удалить его и не использовать)
|
||||||
*/
|
*/
|
||||||
class myXMLHttpRequest
|
class myXMLHttpRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class TWin
|
|||||||
hd+='<table style="width: 100%;">';
|
hd+='<table style="width: 100%;">';
|
||||||
hd+=' <tr>';
|
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 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 align="center" width="100%" style="background-color:#3366CC;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 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 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>';
|
||||||
@ -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()
|
||||||
{
|
{
|
||||||
@ -359,9 +368,14 @@ class TWin
|
|||||||
//json - объект который передастца в виде JSON строки по URL
|
//json - объект который передастца в виде JSON строки по URL
|
||||||
//func - функция которая выполниться после загрузки данных в форму
|
//func - функция которая выполниться после загрузки данных в форму
|
||||||
load(url,json,func,tr)
|
load(url,json,func,tr)
|
||||||
|
{
|
||||||
|
this.loadBody(url,"POST",json,func,tr);
|
||||||
|
console.error('Please use the "loadBody" function.');
|
||||||
|
};
|
||||||
|
loadBody(url,method,json,func,tr)
|
||||||
{
|
{
|
||||||
this.showProgressBar();
|
this.showProgressBar();
|
||||||
var r=createRequestObject();
|
let r=createRequestObject();
|
||||||
r.onreadystatechange = function(r,w,thiz,func)
|
r.onreadystatechange = function(r,w,thiz,func)
|
||||||
{
|
{
|
||||||
return function(){
|
return function(){
|
||||||
@ -379,11 +393,16 @@ class TWin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(r,this.co,this,func,tr)
|
}(r,this.co,this,func,tr)
|
||||||
r.open( "POST", url, true );
|
r.open( method, url, true );
|
||||||
if(json!=null)
|
r.setRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
r.setRequestHeader("Pragma", "no-cache");
|
||||||
|
r.setRequestHeader("Expires", "0");
|
||||||
|
if(json!=null){
|
||||||
r.send(JSON.stringify(json));
|
r.send(JSON.stringify(json));
|
||||||
else
|
}else {
|
||||||
|
r.open( "GET", url, true );
|
||||||
r.send();
|
r.send();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Переместить окно на передний план (Обычно при щелчке на нём)
|
//Переместить окно на передний план (Обычно при щелчке на нём)
|
||||||
@ -417,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()
|
||||||
@ -435,12 +462,13 @@ class TWin
|
|||||||
this.pBarCnt++;
|
this.pBarCnt++;
|
||||||
if(this.pBarDiv==null)
|
if(this.pBarDiv==null)
|
||||||
{
|
{
|
||||||
var img='loading.gif';
|
let img='loading.gif';
|
||||||
if(this.getWidth()<230) img='loading3.gif';
|
if(this.getWidth()<230) img='loading3.gif';
|
||||||
|
|
||||||
this.pBarDiv=document.createElement('div');
|
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.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>';
|
this.pBarDiv.innerHTML='<table style="background-color: rgba(0,0,0,0.5); width: 100%; height: 100%; border-collapse: collapse;"><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);
|
//var eDiv=document.getElementById('eDiv'+this.uid);
|
||||||
this.div.appendChild(this.pBarDiv);
|
this.div.appendChild(this.pBarDiv);
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
@ -322,7 +322,7 @@ Bidi override codes supported - Right-to-Left Embedding [RLE] U+202B, Left-to-Ri
|
|||||||
U+202C POP DIRECTIONAL FORMATTING (PDF)
|
U+202C POP DIRECTIONAL FORMATTING (PDF)
|
||||||
Support for <base href=""> in HTML - uses it to SetBasePath for relative URLs.
|
Support for <base href=""> in HTML - uses it to SetBasePath for relative URLs.
|
||||||
HTML tag - added support for <wbr> or <wbr /> - converted to a soft-hyphen
|
HTML tag - added support for <wbr> or <wbr /> - converted to a soft-hyphen
|
||||||
CSS now takes precedence over HTML attribute e.g. <table bgcolor="black" style="background-color:yellow">
|
CSS now takes precedence over HTML attribute e.g. <table style="background-color:yellow">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": ["mpdf.php", "classes"]
|
"classmap": [
|
||||||
|
"mpdf.php", "classes"]
|
||||||
},
|
},
|
||||||
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
*
|
.gitignore
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
2
metadata/include/mpdf-6.1/tmp/.gitignore
vendored
2
metadata/include/mpdf-6.1/tmp/.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
*
|
.gitignore
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
*
|
.gitignore
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Из файла file.js делаем file_v123456789.js добавив время
|
// Из файла file.js делаем file_v123456789.js добавив время
|
||||||
function getScript($path)
|
function getScript($path,$pathURL="")
|
||||||
{
|
{
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].$path))
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].$path))
|
||||||
{
|
{
|
||||||
|
if($pathURL!="")
|
||||||
|
{
|
||||||
|
return '<script src="' . $pathURL.'?v='.filectime($_SERVER['DOCUMENT_ROOT'] . $path). '"></script>' . "\n";
|
||||||
|
}else {
|
||||||
return '<script src="' . beforeLast($path, '.') . '_v' . filectime($_SERVER['DOCUMENT_ROOT'] . $path) . '.' . afterLast($path, '.') . '"></script>' . "\n";
|
return '<script src="' . beforeLast($path, '.') . '_v' . filectime($_SERVER['DOCUMENT_ROOT'] . $path) . '.' . afterLast($path, '.') . '"></script>' . "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +107,7 @@ function getAccess($key)
|
|||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$result=false;
|
$result=false;
|
||||||
$sql="select main.p_getaccess(:user_id,:key) as acc;";
|
$sql="select main.get_access(:user_id,:key) as acc;";
|
||||||
$stmt = $db->prepare($sql);
|
$stmt = $db->prepare($sql);
|
||||||
if(isset($_SESSION['USER_ID']))
|
if(isset($_SESSION['USER_ID']))
|
||||||
$stmt->bindValue(':user_id', $_SESSION['USER_ID'], PDO::PARAM_INT);
|
$stmt->bindValue(':user_id', $_SESSION['USER_ID'], PDO::PARAM_INT);
|
||||||
@ -512,3 +517,11 @@ function cutBeforeFirst(&$sstr,$fstr)
|
|||||||
return $sub;
|
return $sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUID()
|
||||||
|
{
|
||||||
|
$data = openssl_random_pseudo_bytes(16);
|
||||||
|
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||||
|
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||||
|
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||||
|
}
|
||||||
@ -61,6 +61,8 @@
|
|||||||
*/
|
*/
|
||||||
function findFirstNode($node, $nodename)
|
function findFirstNode($node, $nodename)
|
||||||
{
|
{
|
||||||
|
if($node==null) return null;
|
||||||
|
|
||||||
$mas=array();
|
$mas=array();
|
||||||
$pos=0;
|
$pos=0;
|
||||||
$mas[$pos] = $node->firstChild;
|
$mas[$pos] = $node->firstChild;
|
||||||
|
|||||||
1
metadata/tailwind.min.css
vendored
Normal file
1
metadata/tailwind.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -9,17 +9,16 @@
|
|||||||
</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>
|
||||||
<tr bgcolor="#dadada">
|
<tr style="background-color:#dadada;">
|
||||||
<th style="width:20%">trt('Name')</th>
|
<th style="width:20%">trt('Name')</th>
|
||||||
<th style="width:80%">trt('Value')</th>
|
<th style="width:80%">trt('Value')</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr bgcolor="#dadada">
|
<tr style="background-color:#dadada;">
|
||||||
<td style="width:20%">trt('Name')</td>
|
<td style="width:20%">trt('Name')</td>
|
||||||
<td style="width:80%">trt('Value')</td>
|
<td style="width:80%">trt('Value')</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -285,7 +285,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
|
|||||||
pn=pn.parent;
|
pn=pn.parent;
|
||||||
}
|
}
|
||||||
//Шаблон кнопки по умолчанию
|
//Шаблон кнопки по умолчанию
|
||||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="./?path=${path}" style="${select}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="?path=${path}" style="${select}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||||
|
|
||||||
str=str.replace(/\${path}/g, tn.getTreePath());
|
str=str.replace(/\${path}/g, tn.getTreePath());
|
||||||
str=str.replace(/\${hash}/g, crc32(tn.getTreePath()));
|
str=str.replace(/\${hash}/g, crc32(tn.getTreePath()));
|
||||||
@ -417,7 +417,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
|
|||||||
if(str!='') break;
|
if(str!='') break;
|
||||||
nTmp=nTmp.parentNode;
|
nTmp=nTmp.parentNode;
|
||||||
}
|
}
|
||||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="./?path=${path}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="?path=${path}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||||
str=str.replace(/\${path}/g, this.m_tn[this.m_tn.length-1].getTreePath());
|
str=str.replace(/\${path}/g, this.m_tn[this.m_tn.length-1].getTreePath());
|
||||||
str=str.replace(/\${name}/g, getCdataValue(nodeTree));
|
str=str.replace(/\${name}/g, getCdataValue(nodeTree));
|
||||||
str=str.replace(/\${none}/g, nodeTree.getAttribute("c")=='1' ? 'block' : 'none');
|
str=str.replace(/\${none}/g, nodeTree.getAttribute("c")=='1' ? 'block' : 'none');
|
||||||
|
|||||||
@ -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");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<title>Синхронизация</title>
|
<title>Синхронизация</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
</head>
|
</head>
|
||||||
<body bgColor="#FFFFDD">
|
<body style="background-color:#FFFFDD;">
|
||||||
<?php
|
<?php
|
||||||
//Для переодического запрашивания данных с другого сервера и обновления локальной базы
|
//Для переодического запрашивания данных с другого сервера и обновления локальной базы
|
||||||
//ini_set('max_execution_time',600);//устанавливаем время работы скрипта
|
//ini_set('max_execution_time',600);//устанавливаем время работы скрипта
|
||||||
|
|||||||
@ -10,10 +10,10 @@
|
|||||||
<proc n="Cities"/><!--Процедура для выборки данных-->
|
<proc n="Cities"/><!--Процедура для выборки данных-->
|
||||||
<presentation>
|
<presentation>
|
||||||
<head><;
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user