diff --git a/metadata/dbms/DBMSRecords.java b/metadata/dbms/DBMSRecords.java index 7ff918a..2225d61 100644 --- a/metadata/dbms/DBMSRecords.java +++ b/metadata/dbms/DBMSRecords.java @@ -1,4 +1,4 @@ -package kz.locust.CCALM; //Главная +package com.geovizor.monitoring; //Главная 2 import java.io.BufferedOutputStream; import java.io.BufferedWriter; @@ -29,8 +29,8 @@ import java.util.Random; import java.util.zip.CRC32; import java.util.zip.Checksum; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletResponse; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; @@ -48,7 +48,10 @@ import javax.xml.xpath.XPathFactory; //import org.apache.commons.fileupload.FileItem; //import org.apache.commons.fileupload.disk.DiskFileItemFactory; //import org.apache.commons.fileupload.servlet.ServletFileUpload; +import jakarta.servlet.ServletContext; import org.apache.commons.io.FileUtils; +import org.json.JSONArray; +import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.io.ClassPathResource; @@ -94,18 +97,27 @@ public class DBMSRecords implements ServletContextAware { return new User("none"); } - //Документация по @RequestBody http://javastudy.ru/spring-mvc/json-xml/ + public String sendError(int code, String message) { + JSONObject json = new JSONObject(); + json.put("error_code",code); + json.put("error_message",message); + return json.toString(); + } - @RequestMapping(value = "/records",method = RequestMethod.POST,produces = "application/xml; charset=utf-8") + //Документация по @RequestBody http://javastudy.ru/spring-mvc/json-xml/ application/xml + @RequestMapping(value = "/monitoring/records.php",method = {RequestMethod.POST,RequestMethod.GET},produces = "text/plain; charset=utf-8") @ResponseBody - public Object ajaxTamer(@ModelAttribute User user,@RequestBody byte[] reqData,@RequestParam(required=false,name="lng") String language_id) { + public Object ajaxTamer(@ModelAttribute User user,@RequestBody(required = false) 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=""; + String result=sendError(1,"Request not processed!"); + if(reqData==null) + return result; + //response.setCharacterEncoding("UTF-8"); //response.getWriter().append("Served at: ").append(request.getContextPath()); @@ -114,15 +126,39 @@ public class DBMSRecords implements ServletContextAware { String db_url = ""; String db_login = ""; String db_password = ""; + String data_dir = ""; + Properties prop = new Properties(); + InputStream input = null; + try { + prop.load(new FileInputStream("monitoring.properties")); // load a properties file + //Читаю настройки базы + db_url = prop.getProperty("db.url"); + System.out.println("db.url = " + db_url); + //dbSchema = prop.getProperty("db.schema"); + //System.out.println("db.schema = " + dbSchema); + db_login = prop.getProperty("db.login"); + System.out.println("db.login = " + db_login); + db_password = prop.getProperty("db.password"); + //System.out.println("db.password = " + db_password); + data_dir = prop.getProperty("data-dir"); + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + /*if (input != null) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + }*/ + } + String mail_host = ""; String mail_port = ""; String mail_login = ""; String mail_password = ""; - String data_dir = ""; //Load DB configuration from "config.xml" - try { - //String fullPath = context.getRealPath("/WEB-INF/config.xml"); - //File fXmlFile = new File(fullPath); + /*try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); //Document doc = dBuilder.parse(fXmlFile); @@ -130,13 +166,6 @@ public class DBMSRecords implements ServletContextAware { 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(); - if (nl.item(i).getNodeName().equals("mail-host")) mail_host = nl.item(i).getTextContent(); if (nl.item(i).getNodeName().equals("mail-port")) @@ -145,16 +174,10 @@ public class DBMSRecords implements ServletContextAware { mail_login = nl.item(i).getTextContent(); if (nl.item(i).getNodeName().equals("mail-password")) mail_password = nl.item(i).getTextContent(); - - //if (nl.item(i).getNodeName().equals("metadata")) - // metadata_file = nl.item(i).getTextContent(); - - if (nl.item(i).getNodeName().equals("data-dir")) - data_dir = nl.item(i).getTextContent(); } } catch (Exception ex) { logger.info(ex.getMessage()); - } + }*/ String jspPath = context.getRealPath("/"); @@ -174,7 +197,8 @@ public class DBMSRecords implements ServletContextAware { doc = dBuilder.parse(body); } catch (Exception ex) { logger.info(ex.getMessage()); - return ""; + //return ""; + return sendError(1,"Parsing request error!"); } if (doc != null) { @@ -194,12 +218,14 @@ public class DBMSRecords implements ServletContextAware { logger.info("Connect is OK!"); } else { error=true; - result=""; + //result=""; + result=sendError(1,"An error occurred while connecting to the database!"); } } catch (Exception ex) { logger.info(ex.getMessage()); error=true; - result=""; + //result=""; + result=sendError(1,"An error occurred while connecting to the database!"); } try { @@ -210,7 +236,8 @@ public class DBMSRecords implements ServletContextAware { } catch (SQLException ex) { logger.info(ex.getMessage()); error=true; - result=""; + //result=""; + result=sendError(1,"An set TYPE_SCROLL_SENSITIVE!"); } //response.getWriter().append("fn="+fn); @@ -300,7 +327,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (SQLException ex) { logger.info(ex.getMessage() + " SQL=" + sql_query); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; }finally { if(rs!=null) try{rs.close();}catch(SQLException ex){} @@ -327,7 +355,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; }finally { if(rs!=null) try{rs.close();}catch(SQLException ex){} @@ -354,7 +383,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; }finally { if(rs!=null) try{rs.close();}catch(SQLException ex){} @@ -381,7 +411,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; }finally { if(rs!=null) try{rs.close();}catch(SQLException ex){} @@ -505,7 +536,8 @@ public class DBMSRecords implements ServletContextAware { rs=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } } @@ -616,7 +648,8 @@ public class DBMSRecords implements ServletContextAware { stt.close(); } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } } @@ -705,7 +738,8 @@ public class DBMSRecords implements ServletContextAware { stt.close(); } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } @@ -811,7 +845,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (Exception ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } pagecount = (int) Math.ceil((double) pagecount / (double) rowspagecount); @@ -844,7 +879,7 @@ public class DBMSRecords implements ServletContextAware { } //перебираем RS и строим XML только из тех столбцов которые записанны в секци objects-list поля column в не зависимости от их видимости - String xmlstring = ""; + /*String xmlstring = ""; xmlstring += "\n"; int pos = -1; @@ -893,9 +928,69 @@ public class DBMSRecords implements ServletContextAware { } xmlstring += "\n"; + result=xmlstring;*/ + JSONObject json = new JSONObject(); + json.put("errorCode",0); + json.put("errorMessage",""); + json.put("fn",fn); + json.put("n",typename); + json.put("pc",pagecount); + json.put("pp",pagepos); + JSONArray datas = new JSONArray(); + json.put("data",datas); - result=xmlstring; - //logger.info("xmlstring = " + xmlstring); + int pos = -1; + + // iterate through the java resultset + try { + while (rs.next()) { + pos++; + if ((Integer.parseInt(pagepos) != -1) && ((pos < (Integer.parseInt(pagepos) * rowspagecount)) || (pos >= Integer.parseInt(pagepos) * rowspagecount + rowspagecount))) + continue; + + JSONObject data = new JSONObject(); + datas.put(data); + + + String access = ""; //u = enable update field, d = enable delete field + try { + if (rs.getBoolean("_u") == true) + access += "u"; + } catch (java.sql.SQLException e) { + access += "u"; + } + try { + if (rs.getBoolean("_d") == true) + access += "d"; + } catch (java.sql.SQLException e) { + access += "d"; + } + + String id = ""; + try { + id = rs.getString(nTypeS.getAttributes().getNamedItem("ObjectID").getNodeValue()); + } catch (SQLException e) { + } + + data.put("id", id); + data.put("a", access); + + JSONArray row = new JSONArray(); + data.put("row",row); + for (int i = 0; i < columns.size(); i++) { + try { + String val = rs.getString(columns.get(i)); + row.put(val); + } catch (SQLException e) { + } + } + } + } catch (NumberFormatException | DOMException | SQLException ex) { + logger.info(ex.getMessage()); + } + + result=json.toString(); + //logger.info("json = " + json); rs.close(); stmt.close(); @@ -905,7 +1000,8 @@ public class DBMSRecords implements ServletContextAware { } catch (SQLException ex) { logger.info(ex.getMessage()); ex.printStackTrace(); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } } @@ -997,7 +1093,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } } @@ -1131,14 +1228,16 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query); error=true; } } else { - result=""; + //result=""; + result=sendError(1,"Could not find the requested node!"); error=true; } } @@ -1202,7 +1301,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage()); error=true; } @@ -1217,7 +1317,6 @@ public class DBMSRecords implements ServletContextAware { String content = "Login is: "+ email.toLowerCase()+"\n
New password: " + newPass+""; content += "

Sincerely, the administration of ccalm.org."; - String answer = ""; try { EmailUtility.sendEmail(mail_host, mail_port, mail_login, mail_password, recipient, subject, content); @@ -1239,13 +1338,15 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage()); } } xmlstring = ""; } else { - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"This email address was not registered!"); } } else if (cmd.equals("1")) //Logout @@ -1262,7 +1363,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query); error=true; } @@ -1345,7 +1447,8 @@ public class DBMSRecords implements ServletContextAware { + "]]>"; }else { - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,trt(conn,"Error_in_login_or_password",user)); } } rs.close(); @@ -1354,7 +1457,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query); error=true; } @@ -1363,11 +1467,40 @@ public class DBMSRecords implements ServletContextAware { } else if (cmd.equals("4")) //Create new user { xmlstring = ""; //if error - - String newPass = getRandomString(8); - String sql_query = "select * from main.p__Users_1(4,${country_id},${surname},${name},${company},${position},${phone},${email},${password});"; - + String sql_query = ""; String val; + + //Check exists user by email email + sql_query = "select id from main._users where email=LOWER(TRIM(${email}))"; + val = getSQLValue("string", email); + sql_query = Tools.replaceAll(sql_query,"${email}", val); + try { + Statement stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = stt.executeQuery(sql_query); + if (rs != null) { + try { + if (rs.next()) { + //xmlstring = ""; + xmlstring=sendError(1,trt(conn,"E_mail_already_exists_in_the_database",user)); + error=true; + } + } catch (SQLException ex) { + logger.info(ex.getMessage()); + } + } + rs.close(); + stt.close(); + } catch (SQLException ex) { + logger.info(ex.getMessage()); + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage()); + error=true; + } + + if(!error) { + String newPass = getRandomString(8); + sql_query = "select * from main.p__Users_1(4,${country_id},${surname},${name},${company},${position},${phone},${email},${password});"; + val = getSQLValue("i4", country_id); sql_query = Tools.replaceAll(sql_query,"${country_id}", val); val = getSQLValue("string", lastname); @@ -1384,10 +1517,10 @@ public class DBMSRecords implements ServletContextAware { sql_query = Tools.replaceAll(sql_query,"${email}", val); val = getSQLValue("string", newPass); sql_query = Tools.replaceAll(sql_query,"${password}", val); - + //logger.info("sql_query = " + sql_query); - - + + try { Statement stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stt.executeQuery(sql_query); @@ -1395,13 +1528,13 @@ public class DBMSRecords implements ServletContextAware { try { if (rs.next()) { xmlstring = ""; - + //Отправляем пароль на Email String recipient = email; String subject = "Password for new user on http://www.ccalm.org"; String content = "Login is: "+ email.toLowerCase()+"\n
Password: " + newPass+""; content += "

Sincerely, the administration of ccalm.org."; - + //String answer = ""; try { EmailUtility.sendEmail(mail_host, mail_port, mail_login, mail_password, recipient, subject, content); @@ -1413,7 +1546,7 @@ public class DBMSRecords implements ServletContextAware { //request.setAttribute("Message", resultMessage); //context.getRequestDispatcher("/Result.jsp").forward(request, response); } - + } } catch (SQLException ex) { logger.info(ex.getMessage()); @@ -1425,10 +1558,12 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - xmlstring = ""; + //xmlstring = ""; + xmlstring=sendError(1,"Error: " + ex.getMessage()); error=true; } } + } result=xmlstring; //logger.info("xmlstring = " + xmlstring); @@ -1455,7 +1590,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; } @@ -1635,7 +1771,8 @@ public class DBMSRecords implements ServletContextAware { } } catch (IOException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage()); error=true; } finally { try { @@ -1652,7 +1789,8 @@ public class DBMSRecords implements ServletContextAware { stt=null; } catch (SQLException ex) { logger.info(ex.getMessage()); - result=""; + //result=""; + result=sendError(1,"Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query); error=true; } } @@ -1749,7 +1887,7 @@ public class DBMSRecords implements ServletContextAware { */ } else { - result=""; + result=sendError(1,"Unknown function \"" + fn + "\" !"); error=true; } @@ -1763,8 +1901,8 @@ public class DBMSRecords implements ServletContextAware { } @Override - public void setServletContext(ServletContext context) { - this.context=context; + public void setServletContext(ServletContext servletContext) { + this.context=servletContext; } /** @@ -1775,7 +1913,7 @@ public class DBMSRecords implements ServletContextAware { public FileSystemResource home(HttpServletResponse response,@ModelAttribute User user,@RequestParam(required=false,name="t") String typename,@RequestParam(required=false,name="f") String field,@RequestParam(required=false,name="i") String id) { String metadata_file = ""; - String db_url = ""; + /*String db_url = ""; String db_login = ""; String db_password = ""; //String data_dir = ""; @@ -1805,6 +1943,33 @@ public class DBMSRecords implements ServletContextAware { } } catch (Exception ex) { logger.info(ex.getMessage()); + }*/ + String db_url=""; + String db_login=""; + String db_password=""; + Properties prop = new Properties(); + InputStream input = null; + try { + prop.load(new FileInputStream("monitoring.properties")); // load a properties file + //Читаю настройки базы + db_url = prop.getProperty("db.url"); + System.out.println("db.url = " + db_url); + //dbSchema = prop.getProperty("db.schema"); + //System.out.println("db.schema = " + dbSchema); + db_login = prop.getProperty("db.login"); + System.out.println("db.login = " + db_login); + db_password = prop.getProperty("db.password"); + //System.out.println("db.password = " + db_password); + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + /*if (input != null) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + }*/ } @@ -1919,7 +2084,6 @@ public class DBMSRecords implements ServletContextAware { String result=""; String data_dir=""; - try { //String fullPath = context.getRealPath("/WEB-INF/config.xml"); @@ -2157,7 +2321,7 @@ public class DBMSRecords implements ServletContextAware { return result.toString(); } - //Перевести слово по идентификатору из базы + //Translate word by id from database public String trt(Connection conn,String key,User user) { String result=""; @@ -2165,7 +2329,7 @@ public class DBMSRecords implements ServletContextAware { Statement st = null; try { st = conn.createStatement(); - String sql = "select case when '"+user.language_id+"'='666' then t.translation||'''\"' alse t.translation end as translation from main._translations t where t.identifier='"+key+"' and (t.language_id='"+user.language_id+"' or ('"+user.language_id+"'='666' and t.language_id=1));"; + String sql = "select case when '"+user.language_id+"'='666' then translation||'''\"' else translation end as translation from main._translations t where t.identifier='"+key+"' and (t.language_id='"+user.language_id+"' or ('"+user.language_id+"'='666' and t.language_id=1));"; rs = st.executeQuery(sql); if(rs != null) { if (rs.next()) { @@ -2179,7 +2343,6 @@ public class DBMSRecords implements ServletContextAware { if(st!=null) try{st.close();}catch(SQLException ex) {} if(rs!=null) try{rs.close();}catch(SQLException ex) {} } - if(result.equals("")) { result = Tools.replaceAll(key,"_", " "); @@ -2258,5 +2421,5 @@ public class DBMSRecords implements ServletContextAware { } return doc; } - + } \ No newline at end of file diff --git a/metadata/dbms/editrecord.js b/metadata/dbms/editrecord.js index c0454c6..229f834 100644 --- a/metadata/dbms/editrecord.js +++ b/metadata/dbms/editrecord.js @@ -1204,27 +1204,7 @@ class EdtRec this.hideProgressBar(); if(node.errorCode>0) { - let fullText = node.errorMessage; - let smallText = ''; - let pos1=fullText.indexOf('[['); - let pos2=fullText.indexOf(']]'); - if(pos1>=0 && pos2>=0 && pos1=0){ //Если есть идентификатор того что это перезапись - let okFunc=()=>{ - this.setValue('seq',0); - this.sendData(); //Применить ещё раз - }; - if (smallText != '') - confirm2(trt('Warning'),smallText, fullText, okFunc, null); - else - confirm2(trt('Warning'),smallText, '', okFunc, null); - }else { - if (smallText != '') - alert2(trt('Alert'), smallText, fullText); - else - alert2(trt('Alert'), fullText); - } + alert2(trt('Alert'), node.errorMessage); return; } diff --git a/metadata/dbms/login.js b/metadata/dbms/login.js index a3ea1fa..cabee50 100644 --- a/metadata/dbms/login.js +++ b/metadata/dbms/login.js @@ -19,8 +19,10 @@ class DBMSUser applyReq(req,fn,node) { this.showShadow(false); + if(node.errorCode>0) { alert2(trt('Alert'), node.errorMessage); + return; } if(fn==7) diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js index 2b00a96..598d4cc 100644 --- a/metadata/dbms/showrecord.js +++ b/metadata/dbms/showrecord.js @@ -52,26 +52,7 @@ class SRec this.hideProgressBar(); if(node.errorCode>0) { - let fullText = node.errorMessage; - let smallText = ''; - let pos1=fullText.indexOf('[['); - let pos2=fullText.indexOf(']]'); - if(pos1>=0 && pos2>=0 && pos1=0){ //Если есть идентификатор того что это перезапись - let okFunc=()=>{ - this.setValue('seq',0); - this.sendData(); //Применить ещё раз - }; - if (smallText != '') - confirm2(trt('Warning'),smallText, fullText, okFunc, null); - else - confirm2(trt('Warning'),smallText, '', okFunc, null); - }else { - if (smallText != '') - alert2(trt('Alert'), smallText, fullText); - else - alert2(trt('Alert'), fullText); - } + alert2(trt('Alert'), node.errorMessage); return; } diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js index 4ebbfa6..683597e 100644 --- a/metadata/dbms/tools.js +++ b/metadata/dbms/tools.js @@ -1,18 +1,23 @@ /*jshint esversion: 6 */ "use strict"; +//var g_translations = {'':''}; + //Массив g_translations подгружается отдельно function trt(key) { if(key==null || key===undefined) return ''; - let val=g_translations[key]; - if(val==null || val===undefined) - { - for(let item in g_translations) { - if(item.toLowerCase()==(''+key).toLowerCase()) - { - val=g_translations[item]; - break; + let val=null; + if(g_translations !== undefined){ + val=g_translations[key]; + if(val==null || val===undefined) + { + for(let item in g_translations) { + if(item.toLowerCase()==(''+key).toLowerCase()) + { + val=g_translations[item]; + break; + } } } } @@ -268,6 +273,10 @@ function alert2(title,smallText,fullText,okFunc=null) smallText=fullText; fullText=''; } + let pos1=smallText.indexOf('[['); + let pos2=smallText.indexOf(']]'); + if(pos1>=0 && pos2>=0 && pos1