diff --git a/metadata/dbms/DBMSRecords.java b/metadata/dbms/DBMSRecords.java
index d5dc18b..caeffd4 100644
--- a/metadata/dbms/DBMSRecords.java
+++ b/metadata/dbms/DBMSRecords.java
@@ -1,5 +1,4 @@
-//
-package kz.goodssales.GoodsSales.dbms;
+package kz.locust.CCALM; //Главная
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
@@ -9,13 +8,12 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-//import java.io.OutputStream;
+import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
+import java.io.Reader;
import java.io.StringWriter;
-//import java.io.UnsupportedEncodingException;
import java.io.Writer;
-//import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
@@ -79,8 +77,9 @@ import tctable.Tools;
import tools.EmailUtility;
import tools.User;
+
@Controller
-@SessionAttributes( { "user" }) //Сесионный объект!
+@SessionAttributes( { "user" }) //Сесионный объект
public class DBMSRecords implements ServletContextAware {
//private static final Logger logger = LoggerFactory.getLogger(Translation.class);
@@ -124,10 +123,10 @@ public class DBMSRecords implements ServletContextAware {
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(new ClassPathResource("config.xml").getInputStream());
+ //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++) {
@@ -205,7 +204,7 @@ public class DBMSRecords implements ServletContextAware {
try {
Statement stt0 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
- //st.executeUpdate("SET TIME ZONE 'UTC';");
+ //st.executeUpdate("SET TIME ZONE 'UTC';"); зачем коментил?
stt0.executeUpdate("SET TIME ZONE 'Asia/Almaty';");
stt0.close();
} catch (SQLException ex) {
@@ -396,7 +395,7 @@ public class DBMSRecords implements ServletContextAware {
xml += "";
}
- result=getText(xml,user,conn);
+ result=getText(conn,xml,user);
} else if (fn != null && fn.equals("1")) {
String typename = "";
@@ -570,7 +569,6 @@ public class DBMSRecords implements ServletContextAware {
} catch (XPathExpressionException ex) {
logger.info(ex.getMessage());
}
-
if (nodeList!=null && nodeList.getLength() > 0) {
vt = nodeList.item(0).getAttributes().getNamedItem("vt").getNodeValue();
//If this "file" is then copy it from the temporary folder to the specified path
@@ -1149,7 +1147,6 @@ public class DBMSRecords implements ServletContextAware {
{
String user_id = "";
String cmd="";
- String window_id = "";
String login = "";
String password = "";
String hash = "";
@@ -1165,7 +1162,6 @@ public class DBMSRecords implements ServletContextAware {
try {
cmd = (String) xpath.compile("//metadata/cmd/text()").evaluate(reqNode, XPathConstants.STRING);
- window_id = (String) xpath.compile("//metadata/window_id/text()").evaluate(reqNode, XPathConstants.STRING);
login = (String) xpath.compile("//metadata/login/text()").evaluate(reqNode, XPathConstants.STRING);
password = (String) xpath.compile("//metadata/password/text()").evaluate(reqNode, XPathConstants.STRING);
hash = (String) xpath.compile("//metadata/hash/text()").evaluate(reqNode, XPathConstants.STRING); //Сессия для авто логина если не пустая то сначала пытаемся авторизоваться по ней
@@ -1217,7 +1213,7 @@ public class DBMSRecords implements ServletContextAware {
boolean mEerror = false;
String recipient = login;
- String subject = "New password for CCALM from http://www.locust.kz";
+ String subject = "New password for CCALM from http://www.ccalm.org";
String content = "Login is: "+ email.toLowerCase()+"\n
New password: " + newPass;
@@ -1309,8 +1305,6 @@ public class DBMSRecords implements ServletContextAware {
}
String val;
- val = getSQLValue("i4", window_id);
- sql_query = Tools.replaceAll(sql_query,"${window_id}", val);
val = getSQLValue("i4", user_id);
sql_query = Tools.replaceAll(sql_query,"${user_id}", val);
val = getSQLValue("string", login);
@@ -1403,7 +1397,7 @@ public class DBMSRecords implements ServletContextAware {
//Отправляем пароль на Email
String recipient = email;
- String subject = "Password for new user on http://www.locust.kz";
+ String subject = "Password for new user on http://www.ccalm.org";
String content = "Login is: "+ email.toLowerCase()+"\n
Password: " + newPass;
//String answer = "";
@@ -1594,8 +1588,8 @@ public class DBMSRecords implements ServletContextAware {
writer.write(" \n");
writer.write("
\n");
- writer.write("" + __("Time_and_date_of_generation",user,conn) + ": " + (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date())) + "
");
- writer.write("" + __("Creator",user,conn) + ": " + uName);
+ writer.write("" + __(conn,"Time_and_date_of_generation",user) + ": " + (new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date())) + "
");
+ writer.write("" + __(conn,"Creator",user) + ": " + uName);
//writer.write(filter);
@@ -1605,7 +1599,7 @@ public class DBMSRecords implements ServletContextAware {
expr = xpath.compile("objects-list/@d");
writer.write(" \n");
- writer.write(" " + getText("" + expr.evaluate(nTypeS, XPathConstants.STRING),user,conn) + "\n");
+ writer.write(" " + getText(conn,"" + expr.evaluate(nTypeS, XPathConstants.STRING),user) + "\n");
writer.write(" \n");
writer.write(" ");
@@ -1613,7 +1607,7 @@ public class DBMSRecords implements ServletContextAware {
Object exprResult = expr.evaluate(nTypeS, XPathConstants.NODESET);
nodeList = (NodeList) exprResult;
for (int i = 0; i < nodeList.getLength(); i++) {
- writer.write("| " + getText(nodeList.item(i).getAttributes().getNamedItem("d").getNodeValue(),user,conn)
+ writer.write(" | " + getText(conn,nodeList.item(i).getAttributes().getNamedItem("d").getNodeValue(),user)
+ " | ");
}
writer.write("
\n");
@@ -1770,7 +1764,7 @@ public class DBMSRecords implements ServletContextAware {
public void setServletContext(ServletContext context) {
this.context=context;
}
-
+
/**
* Example request: http://localhost:8080/CCALM/download?t=FrmLocust&f=image_name1&i=1298
*/
@@ -1778,8 +1772,6 @@ public class DBMSRecords implements ServletContextAware {
@ResponseBody
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) {
- //logger.info("user.id="+user.id+" user.name="+user.name+" user.lng="+user.language_id);
-
String metadata_file = "";
String db_url = "";
String db_login = "";
@@ -1787,12 +1779,12 @@ public class DBMSRecords implements ServletContextAware {
//String data_dir = "";
//Load DB configuration from "config.xml"
try {
- String fullPath = context.getRealPath("/WEB-INF/config.xml");
-
- File fXmlFile = new File(fullPath);
+ //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(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++) {
@@ -1907,10 +1899,15 @@ public class DBMSRecords implements ServletContextAware {
if(conn!=null){try{conn.close();}catch(SQLException ex){}}
- response.setContentType("application/octet-stream");
- response.setHeader("Content-Disposition", "attachment; filename="+afterFirst(filename,"_"));
- response.setHeader("Cache-Control", "no-cache");
- return new FileSystemResource(file);
+ if(file!=null) {
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-Disposition", "attachment; filename="+afterFirst(filename,"_"));
+ response.setHeader("Cache-Control", "no-cache");
+ return new FileSystemResource(file);
+ }else {
+ response.setContentType("text/html");
+ return null;
+ }
}
@@ -1923,12 +1920,12 @@ public class DBMSRecords implements ServletContextAware {
try {
- String fullPath = context.getRealPath("/WEB-INF/config.xml");
-
- File fXmlFile = new File(fullPath);
+ //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(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++) {
@@ -2010,12 +2007,12 @@ public class DBMSRecords implements ServletContextAware {
String data_dir = "";
//Load DB configuration from "config.xml"
try {
- String fullPath = context.getRealPath("/WEB-INF/config.xml");
-
- File fXmlFile = new File(fullPath);
+ //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(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++) {
@@ -2046,8 +2043,6 @@ public class DBMSRecords implements ServletContextAware {
String getSQLValue(String t, String v) {
//if($t=='object' && (strtoupper($v)!='NULL' && gettype($v)=='string')) $t='string'; //Если id шники uuid
- //if(t.equals("object")) t="string";
-
if (t.equals("object") || t.equals("uid")) {
if (v.equals(""))
v = "NULL";
@@ -2161,7 +2156,7 @@ public class DBMSRecords implements ServletContextAware {
}
//Перевести слово по идентификатору из базы
- public String __(String key,User user,Connection conn)
+ public String __(Connection conn,String key,User user)
{
String result="";
ResultSet rs=null;
@@ -2175,7 +2170,7 @@ public class DBMSRecords implements ServletContextAware {
result = rs.getString(1);
}
}
- } catch( SQLException ex )
+ } catch( SQLException ex )
{
logger.info(ex.getMessage());
}finally{
@@ -2183,7 +2178,8 @@ public class DBMSRecords implements ServletContextAware {
if(rs!=null) try{rs.close();}catch(SQLException ex) {}
}
- /*if(result.equals(""))
+ /* закоментил так как теперь цифровые id и всё перенесено в базу
+ if(result.equals(""))
{
if(m_props==null || !user.language_id.equals(m_props_loc))
{
@@ -2210,7 +2206,7 @@ public class DBMSRecords implements ServletContextAware {
}
//Translate text by patterns
- public String getText(String text,User user,Connection conn) {
+ public String getText(Connection conn,String text,User user) {
int pos1 = 0;
while (true) {
pos1 = text.indexOf("_('", pos1);
@@ -2220,7 +2216,7 @@ public class DBMSRecords implements ServletContextAware {
if (pos2 == -1)
break;
- text = text.substring(0, pos1) + __(text.substring(pos1 + 3, pos2),user,conn) + text.substring(pos2 + 2);
+ text = text.substring(0, pos1) + __(conn,text.substring(pos1 + 3, pos2),user) + text.substring(pos2 + 2);
}
return text;
}
diff --git a/metadata/dbms/DBMSTree.java b/metadata/dbms/DBMSTree.java
index 74ff483..00117a3 100644
--- a/metadata/dbms/DBMSTree.java
+++ b/metadata/dbms/DBMSTree.java
@@ -20,6 +20,7 @@ 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;
@@ -71,12 +72,12 @@ public class DBMSTree implements ServletContextAware {
//Load DB configuration from "config.xml"
try {
- String fullPath = context.getRealPath("/WEB-INF/config.xml");
-
- File fXmlFile = new File(fullPath);
+ //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(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++) {
diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php
index baa7cf1..e7d7c91 100644
--- a/metadata/dbms/records.php
+++ b/metadata/dbms/records.php
@@ -915,10 +915,12 @@
if($cmd==0) //Restore password by email
{
- $res = $db->query("select 1 from _Users where del=false and email = '$login';");
+ $res = $db->query("select 1 from '.$Schema.'_Users where del=false and email = '$login';");
if($res->rowCount()>0)
{
- mail($login,'BigFootTrade.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: BigFootTrade Site ");
+
+
+ //mail($login,'BigFootTrade.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: BigFootTrade Site ");
}
}elseif($cmd==1) //Logout
{
diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js
index 8808339..5f2cd40 100644
--- a/metadata/dbms/showrecord.js
+++ b/metadata/dbms/showrecord.js
@@ -1035,7 +1035,7 @@ class SRec
th.style.cssText='width: 1%;';
tr.appendChild(th);
th=document.createElement('th');
- th.appendChild( document.createTextNode('Del'));
+ th.appendChild( document.createTextNode(trt('Del')));
th.title = trt('Invert_selection');
th.style.cssText='width: 1%; cursor: pointer; text-decoration: underline;';
th.onmouseover=function(){ this.style.backgroundColor=g_rowColor2; };
@@ -1541,7 +1541,7 @@ class SRec
{
let nodeType=findFirstNode(node, "type");
let typeName=nodeType.getAttribute("n");
- id=nodeType.getAttribute("id");
+ let id=nodeType.getAttribute("id");
deleteHTML(id+'_'+this.uid);
//Rebuild sequential numbering of rows (first column)
let theTable = document.getElementById('thetable'+this.uid); //data table
diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js
index 4dfd8e8..bf87b64 100644
--- a/metadata/dbms/tools.js
+++ b/metadata/dbms/tools.js
@@ -108,6 +108,11 @@ Date.prototype.toDateString = function (){
return '' + y + '-' + (m<=9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d);
}
+Date.prototype.addHours = function(h) {
+ this.setTime(this.getTime() + (h*60*60*1000));
+ return this;
+}
+
//Расширяем класс строки для удаления HTML тегов
String.prototype.stripTags = function() {
return this.replace(/<\/?[^>]+>/g, '');
diff --git a/metadata/include/jscalendar/src/css/jscal2.css b/metadata/include/jscalendar/src/css/jscal2.css
index 22145f7..dcde7af 100644
--- a/metadata/include/jscalendar/src/css/jscal2.css
+++ b/metadata/include/jscalendar/src/css/jscal2.css
@@ -79,7 +79,7 @@ table.DynarchCalendar-titleCont {
.DynarchCalendar-pressed-bottomBar-today {
border: 1px solid #000;
background-color: #777;
- color: #fff;
+ color: #0fff;
padding: 1px 14px;
}
diff --git a/metadata/include/jscalendar/src/css/steel/steel.css b/metadata/include/jscalendar/src/css/steel/steel.css
index d60ed05..7f307b2 100644
--- a/metadata/include/jscalendar/src/css/steel/steel.css
+++ b/metadata/include/jscalendar/src/css/steel/steel.css
@@ -44,8 +44,8 @@
.DynarchCalendar-day-selected {
- background-color: #1864fc;
- color: #fff !important;
+ background-color: #729ff7;
+ color: #000000 !important;
background-image: url("coolbg.png");
background-position: 0 50%;
background-repeat: repeat-x;
diff --git a/metadata/include/tinymce/jscripts/tiny_mce/plugins/style/props.htm b/metadata/include/tinymce/jscripts/tiny_mce/plugins/style/props.htm
index 7dc087a..de0a3cd 100644
--- a/metadata/include/tinymce/jscripts/tiny_mce/plugins/style/props.htm
+++ b/metadata/include/tinymce/jscripts/tiny_mce/plugins/style/props.htm
@@ -15,13 +15,13 @@