Hikari pool add data
This commit is contained in:
@ -2,11 +2,8 @@ package org.ccalm.main;
|
|||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.*;
|
||||||
import java.sql.DriverManager;
|
import java.util.List;
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -21,13 +18,20 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.http.CacheControl;
|
import org.springframework.http.CacheControl;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.context.ServletContextAware;
|
import org.springframework.web.context.ServletContextAware;
|
||||||
|
|
||||||
|
|
||||||
|
import org.ccalm.main.TranslationUtils;
|
||||||
|
import tools.DBTools;
|
||||||
import tools.User;
|
import tools.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,26 +50,13 @@ public class MainController implements ServletContextAware {
|
|||||||
this.context=context;
|
this.context=context;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If not created object "user", create him.
|
private final NamedParameterJdbcTemplate jdbcTemplate;
|
||||||
//@ModelAttribute("user")
|
|
||||||
//public User populatePerson() {
|
|
||||||
// return new User("none");
|
|
||||||
//}
|
|
||||||
|
|
||||||
/**
|
@Autowired
|
||||||
* Simply selects the home view to render by returning its name.
|
public MainController(NamedParameterJdbcTemplate jdbcTemplate) {
|
||||||
*/
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
/*@RequestMapping(value = "/test", method = RequestMethod.GET)
|
this.m_props = new Properties();
|
||||||
public String home(Locale locale, Model model) {
|
}
|
||||||
logger.info("Welcome home! The client locale is {}.", locale);
|
|
||||||
|
|
||||||
//Date date = new Date();
|
|
||||||
//DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
|
|
||||||
//String formattedDate = dateFormat.format(date);
|
|
||||||
//model.addAttribute("serverTime", formattedDate );
|
|
||||||
|
|
||||||
return "index";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply selects the home view to render by returning its name.
|
* Simply selects the home view to render by returning its name.
|
||||||
@ -114,125 +105,20 @@ public class MainController implements ServletContextAware {
|
|||||||
* Testing new main index page
|
* Testing new main index page
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||||
public String home2(@ModelAttribute User user, Model model,@CookieValue(value = "lng", defaultValue = "1") String language_id) {
|
public String home2(Model model,@CookieValue(value = "lng", defaultValue = "1") String language_id_str) {
|
||||||
//logger.info("Welcome home! The client locale is {}.", locale);
|
int 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);
|
|
||||||
|
|
||||||
String db_url="";
|
|
||||||
String db_login="";
|
|
||||||
String db_password="";
|
|
||||||
Properties prop = new Properties();
|
|
||||||
try {
|
try {
|
||||||
prop.load(new FileInputStream("org_ccalm_main.properties")); // load a properties file
|
language_id = Integer.parseInt(language_id_str);
|
||||||
db_url = prop.getProperty("spring.datasource.url");
|
} catch (NumberFormatException e) {
|
||||||
db_login = prop.getProperty("spring.datasource.username");
|
language_id = 1; // Значение по умолчанию в случае ошибки
|
||||||
db_password = prop.getProperty("spring.datasource.password");
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.error("Error load org_ccalm_main.properties",e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get language from database
|
//model.addAttribute("uName",user.name+" ("+user.role+")");
|
||||||
Connection conn = null;
|
model.addAttribute("m_locale",language_id);
|
||||||
try{
|
//model.addAttribute("country_id",user.country_id);
|
||||||
Class.forName("org.postgresql.Driver");
|
|
||||||
conn = DriverManager.getConnection(db_url,db_login,db_password);
|
|
||||||
if(conn!=null)
|
|
||||||
{
|
|
||||||
System.out.println("Connect is OK!");
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect is ERROR<br>");
|
|
||||||
}
|
|
||||||
}catch(Exception e)
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect Exception:"+e.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Statement st = conn.createStatement();
|
|
||||||
ResultSet rs=null;
|
|
||||||
if(user.id!=null){
|
|
||||||
|
|
||||||
if(language_id!=null && !language_id.equals(""))
|
|
||||||
{
|
|
||||||
//Set the language for the current user if it is transferred.
|
|
||||||
user.language_id=language_id;
|
|
||||||
try {
|
|
||||||
st.execute("update main._users set language_id='"+user.language_id+"' where id="+user.id);
|
|
||||||
} catch( SQLException ex )
|
|
||||||
{
|
|
||||||
System.out.println("<br>SQLException:"+ex.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Select language for current user
|
|
||||||
try {
|
|
||||||
String sql="select language_id,country_id from main._users u where u.id="+String.valueOf(user.id)+";";
|
|
||||||
rs = st.executeQuery(sql);
|
|
||||||
} catch( SQLException ex )
|
|
||||||
{
|
|
||||||
System.out.println("<br>SQLException:"+ex.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rs!=null)
|
|
||||||
{
|
|
||||||
while (rs.next())
|
|
||||||
{
|
|
||||||
user.language_id = rs.getString("language_id");
|
|
||||||
user.country_id = rs.getString("country_id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
st.close();
|
|
||||||
} catch( SQLException ex )
|
|
||||||
{
|
|
||||||
System.out.println("<br>SQLException:"+ex.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send user name and role
|
|
||||||
model.addAttribute("uName",user.name+" ("+user.role+")");
|
|
||||||
model.addAttribute("m_locale",user.language_id);
|
|
||||||
model.addAttribute("country_id",user.country_id);
|
|
||||||
|
|
||||||
//Для перевода выбираю всё что под номером 1 в переводе
|
//Для перевода выбираю всё что под номером 1 в переводе
|
||||||
try {
|
TranslationUtils.loadTranslations(jdbcTemplate, language_id, model);
|
||||||
m_props = new Properties();
|
|
||||||
Statement stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
|
||||||
String sql_query = "select identifier,case when '"+user.language_id+"'='666' then translation||'''\"' else translation end as translation from main._translations t where t.del=false and (t.language_id='"+user.language_id+"' or ('"+user.language_id+"'='666' and t.language_id=1)) and translation_type_id=1;";
|
|
||||||
ResultSet rs = stt.executeQuery(sql_query);
|
|
||||||
if (rs != null) {
|
|
||||||
while (rs.next())
|
|
||||||
{
|
|
||||||
String identifier = rs.getString("identifier");
|
|
||||||
String translation = rs.getString("translation");
|
|
||||||
m_props.setProperty(identifier, translation);
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
}
|
|
||||||
stt.close();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
logger.info(ex.getMessage());
|
|
||||||
}
|
|
||||||
Set<Object> keys = m_props.keySet();
|
|
||||||
for(Object k:keys){
|
|
||||||
String key = (String)k;
|
|
||||||
String val="";
|
|
||||||
if(val.equals(""))
|
|
||||||
{
|
|
||||||
val = m_props.getProperty(key,"");
|
|
||||||
if(val.equals(""))
|
|
||||||
{
|
|
||||||
val = val.replaceAll("_", " ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model.addAttribute(key,val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try{ conn.close(); }catch(Exception e){}
|
|
||||||
|
|
||||||
//return "index";
|
//return "index";
|
||||||
return "test";
|
return "test";
|
||||||
@ -248,77 +134,33 @@ public class MainController implements ServletContextAware {
|
|||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
JSONArray array=new JSONArray();
|
JSONArray array=new JSONArray();
|
||||||
|
|
||||||
String db_url="";
|
|
||||||
String db_login="";
|
|
||||||
String db_password="";
|
|
||||||
//String data_dir = "";
|
|
||||||
Properties prop = new Properties();
|
|
||||||
try {
|
try {
|
||||||
prop.load(new FileInputStream("org_ccalm_main.properties")); // load a properties file
|
String sql="""
|
||||||
db_url = prop.getProperty("spring.datasource.url");
|
select
|
||||||
db_login = prop.getProperty("spring.datasource.username");
|
id,
|
||||||
db_password = prop.getProperty("spring.datasource.password");
|
lon,
|
||||||
//data_dir = prop.getProperty("data.dir");
|
lat,
|
||||||
} catch (Exception e) {
|
type,
|
||||||
e.printStackTrace();
|
terrain
|
||||||
logger.error("Error load org_ccalm_main.properties",e);
|
from main.p_dataindex(to_timestamp(:date_start)::timestamp without time zone,to_timestamp(:date_end)::timestamp without time zone);
|
||||||
}
|
""";
|
||||||
|
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||||
//Connect to database
|
parameters.addValue("date_start", date_start, Types.INTEGER);
|
||||||
Connection conn = null;
|
parameters.addValue("date_end", date_end, Types.INTEGER);
|
||||||
try{
|
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
||||||
Class.forName("org.postgresql.Driver");
|
for (int i = 0; i < ret.size(); i++) {
|
||||||
conn = DriverManager.getConnection(db_url,db_login,db_password);
|
JSONObject rsRez = new JSONObject(ret.get(i));
|
||||||
if(conn!=null)
|
|
||||||
{
|
|
||||||
System.out.println("Connect is OK!");
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect is ERROR<br>");
|
|
||||||
}
|
|
||||||
}catch(Exception e)
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect Exception:"+e.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
String sql;
|
|
||||||
sql = "select * from main.p_dataindex(to_timestamp("+date_start+")::timestamp without time zone,to_timestamp("+date_end+")::timestamp without time zone);";
|
|
||||||
ResultSet rs = null;
|
|
||||||
try {
|
|
||||||
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
|
||||||
rs = stmt.executeQuery(sql);
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
logger.info(ex.getMessage());
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (rs.next()) {
|
|
||||||
JSONObject rsRez = new JSONObject();
|
|
||||||
rsRez.put("id",rs.getInt("id"));
|
|
||||||
rsRez.put("lon",rs.getDouble("lon"));
|
|
||||||
rsRez.put("lat",rs.getDouble("lat"));
|
|
||||||
rsRez.put("type",rs.getInt("type"));
|
|
||||||
rsRez.put("terrain",rs.getString("terrain"));
|
|
||||||
array.put(rsRez);
|
array.put(rsRez);
|
||||||
}
|
}
|
||||||
} catch (SQLException ex) {
|
} catch( DataAccessException ex )
|
||||||
logger.info(ex.getMessage());
|
{
|
||||||
ex.printStackTrace();
|
logger.error("Error",ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("Error_code", "0");
|
result.put("Error_code", "0");
|
||||||
result.put("Error_message", "");
|
result.put("Error_message", "");
|
||||||
|
|
||||||
result.put("data", array);
|
result.put("data", array);
|
||||||
|
|
||||||
if(conn!=null)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
package org.ccalm.main;
|
package org.ccalm.main;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.sql.Connection;
|
import java.sql.*;
|
||||||
import java.sql.DriverManager;
|
import java.util.*;
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
//import javax.servlet.ServletContext;
|
//import javax.servlet.ServletContext;
|
||||||
|
|
||||||
@ -15,11 +10,16 @@ import jakarta.servlet.ServletContext;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DataAccessException;
|
||||||
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.context.ServletContextAware;
|
import org.springframework.web.context.ServletContextAware;
|
||||||
|
|
||||||
|
import tools.DBTools;
|
||||||
import tools.User;
|
import tools.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,117 +32,103 @@ public class TranslationController implements ServletContextAware {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(TranslationController.class);
|
private static final Logger logger = LoggerFactory.getLogger(TranslationController.class);
|
||||||
private ServletContext context;
|
private ServletContext context;
|
||||||
|
|
||||||
/*@Value("${spring.datasource.url}")
|
private final NamedParameterJdbcTemplate jdbcTemplate;
|
||||||
private String dbUrl;
|
|
||||||
@Value("${spring.datasource.username}")
|
|
||||||
private String dbUsername;
|
|
||||||
@Value("${spring.datasource.password}")
|
|
||||||
private String dbPassword;*/
|
|
||||||
|
|
||||||
//If not created object "user", create him.
|
@Autowired
|
||||||
//@ModelAttribute("user")
|
public TranslationController(NamedParameterJdbcTemplate jdbcTemplate) {
|
||||||
//public User populatePerson() {
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
// return new User("none");
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply selects the home view to render by returning its name.
|
* Simply selects the home view to render by returning its name.
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/translation", method = RequestMethod.GET)
|
@RequestMapping(value = "/translation", method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String home(@ModelAttribute User user/*, Locale locale*/, Model model) {
|
public String home(
|
||||||
|
Model model,
|
||||||
String db_url="";
|
@CookieValue(value = "lng", defaultValue = "1") String language_id
|
||||||
String db_login="";
|
) {
|
||||||
String db_password="";
|
|
||||||
//String data_dir = "";
|
|
||||||
Properties prop = new Properties();
|
|
||||||
try {
|
|
||||||
prop.load(new FileInputStream("org_ccalm_main.properties")); // load a properties file
|
|
||||||
db_url = prop.getProperty("spring.datasource.url");
|
|
||||||
db_login = prop.getProperty("spring.datasource.username");
|
|
||||||
db_password = prop.getProperty("spring.datasource.password");
|
|
||||||
//data_dir = prop.getProperty("data.dir");
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.error("Error load org_ccalm_main.properties",e);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get language from database
|
|
||||||
Connection conn = null;
|
|
||||||
try{
|
|
||||||
Class.forName("org.postgresql.Driver");
|
|
||||||
conn = DriverManager.getConnection(db_url,db_login,db_password);
|
|
||||||
if(conn!=null)
|
|
||||||
{
|
|
||||||
System.out.println("Connect is OK!");
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect is ERROR<br>");
|
|
||||||
}
|
|
||||||
}catch(Exception e)
|
|
||||||
{
|
|
||||||
System.out.println("<br>Connect Exception:"+e.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
try {
|
try {
|
||||||
Statement st = conn.createStatement();
|
String sql="""
|
||||||
ResultSet rs=null;
|
select
|
||||||
try {
|
identifier,
|
||||||
String sql_query = "select identifier,case when '"+user.language_id+"'='666' then translation||'''\"' else translation end as translation from main._translations t where t.del=false and (t.language_id='"+user.language_id+"' or ('"+user.language_id+"'='666' and t.language_id=1)) and translation_type_id=1 order by identifier;";
|
translation
|
||||||
rs = st.executeQuery(sql_query);
|
from
|
||||||
} catch( SQLException ex )
|
main._translations t
|
||||||
{
|
where
|
||||||
System.out.println("<br>SQLException:"+ex.getMessage()+"<br>");
|
t.del=false and
|
||||||
|
t.language_id=:language_id and
|
||||||
|
translation_type_id=1
|
||||||
|
order by
|
||||||
|
identifier
|
||||||
|
""";
|
||||||
|
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||||
|
parameters.addValue("language_id", language_id, Types.INTEGER);
|
||||||
|
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
||||||
|
for (String str : ret) {
|
||||||
|
JSONObject obj = new JSONObject(str);
|
||||||
|
props.setProperty(obj.getString("identifier"), obj.getString("translation"));
|
||||||
}
|
}
|
||||||
|
} catch( DataAccessException ex )
|
||||||
if(rs!=null)
|
|
||||||
{
|
{
|
||||||
while (rs.next())
|
logger.info(ex.getMessage());
|
||||||
{
|
|
||||||
if(rs.getString("translation")!=null)
|
|
||||||
props.setProperty(rs.getString("identifier"), rs.getString("translation"));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
st.close();
|
|
||||||
} catch( SQLException ex )
|
|
||||||
{
|
|
||||||
System.out.println("<br>SQLException:"+ex.getMessage()+"<br>");
|
|
||||||
}
|
|
||||||
try{ conn.close(); }catch(Exception e){}
|
|
||||||
|
|
||||||
//Create JavaScript text
|
|
||||||
/*
|
|
||||||
InputStream utf8in = getClass().getClassLoader().getResourceAsStream("messages_"+user.lng+".properties");
|
|
||||||
Reader reader;
|
|
||||||
try {
|
|
||||||
reader = new InputStreamReader(utf8in, "UTF-8");
|
|
||||||
props.load(reader);
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
}catch (IOException e) {
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//Переписываю в JavaScript код
|
//Переписываю в JavaScript код
|
||||||
//JSONArray data = new JSONArray();
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
String result="";
|
|
||||||
Set<Object> keys = props.keySet();
|
Set<Object> keys = props.keySet();
|
||||||
for(Object k:keys){
|
for(Object k:keys){
|
||||||
String key = ((String)k).trim();
|
String key = ((String)k).trim();
|
||||||
String val = props.getProperty(key,"");
|
String val = props.getProperty(key,"");
|
||||||
|
|
||||||
data.put(key,val);
|
data.put(key,val);
|
||||||
//JSONObject obj = new JSONObject();
|
|
||||||
//obj.put(key,val);
|
|
||||||
//data.put(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//model.addAttribute("keys",result);
|
|
||||||
//return "translation";
|
|
||||||
return "var g_translations = "+data.toString();
|
return "var g_translations = "+data.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Функция для получения переводов в формате JSON.
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/api/translation", produces = "application/json")
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> getTranslations(
|
||||||
|
@CookieValue(value = "lng", defaultValue = "1") String language_id
|
||||||
|
) {
|
||||||
|
|
||||||
|
Map<String, String> translations = new HashMap<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String sql = """
|
||||||
|
select
|
||||||
|
identifier,
|
||||||
|
translation
|
||||||
|
from
|
||||||
|
main._translations t
|
||||||
|
where
|
||||||
|
t.del = false
|
||||||
|
and t.language_id = :language_id
|
||||||
|
and translation_type_id = 1
|
||||||
|
order by identifier
|
||||||
|
""";
|
||||||
|
|
||||||
|
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||||
|
parameters.addValue("language_id", language_id, Types.INTEGER);
|
||||||
|
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, parameters);
|
||||||
|
|
||||||
|
for (Map<String, Object> row : rows) {
|
||||||
|
String identifier = (String) row.get("identifier");
|
||||||
|
String translation = (String) row.get("translation");
|
||||||
|
translations.put(identifier, translation);
|
||||||
|
}
|
||||||
|
} catch (DataAccessException ex) {
|
||||||
|
logger.info("Error fetching translations: " + ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return translations;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setServletContext(ServletContext servletContext) {
|
public void setServletContext(ServletContext servletContext) {
|
||||||
this.context=servletContext;
|
this.context=servletContext;
|
||||||
|
|||||||
45
src/main/java/org/ccalm/main/TranslationUtils.java
Normal file
45
src/main/java/org/ccalm/main/TranslationUtils.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package org.ccalm.main;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
import org.springframework.dao.DataAccessException;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import tools.DBTools;
|
||||||
|
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class TranslationUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TranslationUtils.class);
|
||||||
|
|
||||||
|
public static void loadTranslations(NamedParameterJdbcTemplate jdbcTemplate, int language_id, Model model) {
|
||||||
|
// Для перевода выбираю всё что под номером 1 в переводе
|
||||||
|
try {
|
||||||
|
String sql = """
|
||||||
|
select identifier, translation from main._translations t
|
||||||
|
where t.del = false and t.language_id = :language_id and translation_type_id = 1;
|
||||||
|
""";
|
||||||
|
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||||
|
parameters.addValue("language_id", language_id, Types.INTEGER);
|
||||||
|
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
||||||
|
for (String jsonString : ret) {
|
||||||
|
JSONObject obj = new JSONObject(jsonString);
|
||||||
|
String key = obj.getString("identifier");
|
||||||
|
String val = obj.getString("translation");
|
||||||
|
if (val.equals("")) {
|
||||||
|
val = val.replaceAll("_", " ");
|
||||||
|
}
|
||||||
|
model.addAttribute(key, val);
|
||||||
|
}
|
||||||
|
} catch (DataAccessException ex) {
|
||||||
|
logger.error("Error loading translations for language_id: {}", language_id, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,7 @@ import io.jsonwebtoken.Claims;
|
|||||||
import io.jsonwebtoken.Jws;
|
import io.jsonwebtoken.Jws;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.ccalm.main.TranslationUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -85,7 +86,7 @@ public class EngineController implements ServletContextAware {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@CookieValue(value = "jwt_a", defaultValue = "") String jwt_a,
|
@CookieValue(value = "jwt_a", defaultValue = "") String jwt_a,
|
||||||
@CookieValue(value = "lng", defaultValue = "1") String language_id
|
@CookieValue(value = "lng", defaultValue = "1") int language_id
|
||||||
) {
|
) {
|
||||||
if (jwt_a.equals("") || Tools.countOccurrences(jwt_a, '.') != 2) {
|
if (jwt_a.equals("") || Tools.countOccurrences(jwt_a, '.') != 2) {
|
||||||
String redirectUrl = "/login/login?msg=Please_log_in";
|
String redirectUrl = "/login/login?msg=Please_log_in";
|
||||||
@ -132,7 +133,6 @@ public class EngineController implements ServletContextAware {
|
|||||||
model.addAttribute("m_locale",language_id);
|
model.addAttribute("m_locale",language_id);
|
||||||
model.addAttribute("country_id",country_id);
|
model.addAttribute("country_id",country_id);
|
||||||
|
|
||||||
|
|
||||||
//Send translation to user
|
//Send translation to user
|
||||||
/*InputStream utf8in = getClass().getClassLoader().getResourceAsStream("messages_"+user.lng+".properties");
|
/*InputStream utf8in = getClass().getClassLoader().getResourceAsStream("messages_"+user.lng+".properties");
|
||||||
if(utf8in!=null)
|
if(utf8in!=null)
|
||||||
@ -351,38 +351,7 @@ public class EngineController implements ServletContextAware {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
//Для перевода выбираю всё что под номером 1 в переводе
|
//Для перевода выбираю всё что под номером 1 в переводе
|
||||||
|
TranslationUtils.loadTranslations(jdbcTemplate, language_id, model);
|
||||||
try {
|
|
||||||
String sql="""
|
|
||||||
select identifier,translation from main._translations t where t.del=false and t.language_id=:language_id and translation_type_id=1;
|
|
||||||
""";
|
|
||||||
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
|
||||||
parameters.addValue("language_id", language_id, Types.INTEGER);
|
|
||||||
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
|
||||||
for (int i = 0; i < ret.size(); i++) {
|
|
||||||
JSONObject obj = new JSONObject(ret.get(i));
|
|
||||||
m_props.setProperty(obj.getString("identifier"), obj.getString("translation"));
|
|
||||||
}
|
|
||||||
} catch( DataAccessException ex )
|
|
||||||
{
|
|
||||||
logger.info(ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<Object> keys = m_props.keySet();
|
|
||||||
for(Object k:keys){
|
|
||||||
String key = (String)k;
|
|
||||||
String val="";
|
|
||||||
if(val.equals(""))
|
|
||||||
{
|
|
||||||
val = m_props.getProperty(key,"");
|
|
||||||
if(val.equals(""))
|
|
||||||
{
|
|
||||||
val = val.replaceAll("_", " ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model.addAttribute(key,val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Подложка Substrate_head Substrate_tail
|
//Подложка Substrate_head Substrate_tail
|
||||||
String Substrate_head="";
|
String Substrate_head="";
|
||||||
|
|||||||
@ -112,40 +112,50 @@
|
|||||||
.centered-text a:hover {
|
.centered-text a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Header styles */
|
||||||
|
.header {
|
||||||
|
width: 100%;
|
||||||
|
background-color: var(--back-color2);
|
||||||
|
color: white;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- Форма авторизации -->
|
<div class="header">
|
||||||
<div class="login-container" id="loginForm">
|
<span>Username</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Блок ниже должен быть по центру вертикали и горизонтали -->
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div class="login-container" id="loginForm">
|
||||||
<h2 th:text="${Authorization}">Authorization</h2>
|
<h2 th:text="${Authorization}">Authorization</h2>
|
||||||
<div>
|
<div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="login0"><span th:text="${Login}">Login</span> (E-mail):</label>
|
<label for="1_login"><span th:text="${Login}">Login</span> (E-mail):</label>
|
||||||
<input type="text" id="login0" name="login" maxlength="50" placeholder="Введите логин или email">
|
<input type="text" id="1_login" name="1_login" maxlength="50" th:placeholder="${Enter_login_or_email}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password0">Пароль:</label>
|
<label for="1_password" th:text="${Password}">Password:</label>
|
||||||
<input type="password" id="password0" name="password" maxlength="33" placeholder="Введите пароль">
|
<input type="password" id="1_password" name="password" maxlength="33" th:placeholder="${Enter_password}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<a href="#" onclick="showRestoreForm();">Восстановление пароля</a>
|
<button id="loginBtn" class="button" th:text="${Log_in}" onclick="authorizeUser()">Log in</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="login-container" style="display: none;" id="registrationForm">
|
||||||
<button id="loginBtn" class="button">Войти</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="progress-bar" id="progressBar">
|
|
||||||
<span>Загрузка...</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Форма регистрации -->
|
|
||||||
<div class="login-container" style="display: none;" id="registrationForm">
|
|
||||||
<h2 th:text="${Registration}">Registration</h2>
|
<h2 th:text="${Registration}">Registration</h2>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
@ -184,7 +194,6 @@
|
|||||||
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Checkbox for Privacy Policy -->
|
|
||||||
<div class="form-group checkbox-group">
|
<div class="form-group checkbox-group">
|
||||||
<input type="checkbox" id="privacyPolicy" onclick="toggleRegisterButton()">
|
<input type="checkbox" id="privacyPolicy" onclick="toggleRegisterButton()">
|
||||||
<label for="privacyPolicy">
|
<label for="privacyPolicy">
|
||||||
@ -193,29 +202,98 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button id="registerBtn" class="button" th:text="${Registration}" disabled>Registration</button>
|
<button id="registerBtn" class="button" th:text="${Registration}" disabled onclick="registrationUser()">Registration</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login-container" style="display: none;" id="recoveryForm">
|
||||||
|
<h2 th:text="${Password_recovery}">Password_recovery</h2>
|
||||||
|
<div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="3_email"><span th:text="${E_mail}">Email</span> *</label>
|
||||||
|
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="nextBtn" class="button" th:text="${Next}">Next</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="progress-bar" id="progressBar2">
|
<div class="progress-bar" id="progressBar2">
|
||||||
<span>Загрузка...</span>
|
<span>Загрузка...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Password recovery -->
|
<div class="login-container" style="display: none;" id="changeForm">
|
||||||
<div class="login-container" style="display: none;" id="registrationForm">
|
|
||||||
<h2 th:text="${Password_recovery}">Password_recovery</h2>
|
<h2 th:text="${Password_recovery}">Password_recovery</h2>
|
||||||
<div>
|
<div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="3_email"><span th:text="${Login}">Login</span> <span th:text="${E_mail}">Email</span></label>
|
||||||
|
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Ссылки для переключения -->
|
<div class="form-group">
|
||||||
<div class="centered-text">
|
<label for="4_oldPassword"><span th:text="${Old_password}">Old_password</span></label>
|
||||||
|
<input type="text" id="4_oldPassword" name="old_password" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="4_newPassword"><span th:text="${New_password}">New_password</span></label>
|
||||||
|
<input type="text" id="4_newPassword" name="new_password" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="4_repeatPassword"><span th:text="${Repeat_password}">New_password</span></label>
|
||||||
|
<input type="text" id="4_repeatPassword" name="repeat_password" maxlength="50" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="4_btn" class="button" th:text="${Change_password}" onclick="changePassword()">Change_password</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="login-container" style="display: none;" id="totpForm">
|
||||||
|
<h2 th:text="${New_totp_key}">New_totp_key</h2>
|
||||||
|
<div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="5_email"><span th:text="${Login}">Login</span> (E-mail)</label>
|
||||||
|
<input type="text" id="5_email" name="email" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="5_password"><span th:text="${Password}">Password</span></label>
|
||||||
|
<input type="text" id="5_password" name="password" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="5_oldTotp"><span th:text="${Old_totp}">Old_totp</span></label>
|
||||||
|
<input type="text" id="5_oldTotp" name="Old_totp" maxlength="50" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="5_repeatPassword"><span th:text="${New_totp_code}">New_password</span></label>
|
||||||
|
<input type="text" id="5_repeatPassword" name="repeat_password" maxlength="50" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="5_btn" class="button" th:text="${New_totp_key}" onclick="newTotp()">New_totp_key</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="centered-text">
|
||||||
<p><a href="#" onclick="showForm(1);" th:text="${Authorization}">Authorization</a></p>
|
<p><a href="#" onclick="showForm(1);" th:text="${Authorization}">Authorization</a></p>
|
||||||
<p><a href="#" onclick="showForm(2);" th:text="${Create_a_new_user}">Create a new user</a></p>
|
<p><a href="#" onclick="showForm(2);" th:text="${Create_a_new_user}">Create a new user</a></p>
|
||||||
<p><a href="#" onclick="showForm(3);" th:text="${Password_recovery}">Password recovery</a></p>
|
<p><a href="#" onclick="showForm(3);" th:text="${Password_recovery}">Password recovery</a></p>
|
||||||
<p><a href="#" onclick="showForm(4);" th:text="${Change_password}">Change password</a></p>
|
<p><a href="#" onclick="showForm(4);" th:text="${Change_password}">Change password</a></p>
|
||||||
<p><a href="#" onclick="showForm(5);" th:text="${Get_new_TOTP_key}">Get new TOTP key</a></p>
|
<p><a href="#" onclick="showForm(5);" th:text="${Get_new_TOTP_key}">Get new TOTP key</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -223,9 +301,11 @@
|
|||||||
function showForm(num) {
|
function showForm(num) {
|
||||||
document.getElementById('loginForm').style.display = num === 1 ? 'block' : 'none';
|
document.getElementById('loginForm').style.display = num === 1 ? 'block' : 'none';
|
||||||
document.getElementById('registrationForm').style.display = num === 2 ? 'block' : 'none';
|
document.getElementById('registrationForm').style.display = num === 2 ? 'block' : 'none';
|
||||||
|
document.getElementById('recoveryForm').style.display = num === 3 ? 'block' : 'none';
|
||||||
|
document.getElementById('changeForm').style.display = num === 4 ? 'block' : 'none';
|
||||||
|
document.getElementById('totpForm').style.display = num === 5 ? 'block' : 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Функция для включения/выключения кнопки регистрации в зависимости от состояния галочки
|
// Функция для включения/выключения кнопки регистрации в зависимости от состояния галочки
|
||||||
function toggleRegisterButton() {
|
function toggleRegisterButton() {
|
||||||
const checkbox = document.getElementById('privacyPolicy');
|
const checkbox = document.getElementById('privacyPolicy');
|
||||||
@ -235,9 +315,9 @@
|
|||||||
|
|
||||||
// Функция для обработки авторизации
|
// Функция для обработки авторизации
|
||||||
function authorizeUser() {
|
function authorizeUser() {
|
||||||
const login = document.getElementById('login0').value;
|
const login = document.getElementById('1_login').value;
|
||||||
const password = document.getElementById('password0').value;
|
const password = document.getElementById('1_password').value;
|
||||||
const obj = { login, password, appid: 'ccalm' };
|
const obj = {login, password, appid: 'ccalm'};
|
||||||
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (data.error_code == 0) {
|
if (data.error_code == 0) {
|
||||||
@ -251,8 +331,60 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function registrationUser() {
|
||||||
|
const login = document.getElementById('1_login').value;
|
||||||
|
const password = document.getElementById('1_password').value;
|
||||||
|
const obj = {login, password, appid: 'ccalm'};
|
||||||
|
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == 0) {
|
||||||
|
window.location.href = "/engine";
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt(data.error_message));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePassword() {
|
||||||
|
const login = document.getElementById('1_login').value;
|
||||||
|
const password = document.getElementById('1_password').value;
|
||||||
|
const obj = {login, password, appid: 'ccalm'};
|
||||||
|
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == 0) {
|
||||||
|
window.location.href = "/engine";
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt(data.error_message));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function newTotp() {
|
||||||
|
const login = document.getElementById('1_login').value;
|
||||||
|
const password = document.getElementById('1_password').value;
|
||||||
|
const obj = {login, password, appid: 'ccalm'};
|
||||||
|
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||||
|
if (ok) {
|
||||||
|
if (data.error_code == 0) {
|
||||||
|
window.location.href = "/engine";
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt(data.error_message));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Изначально показываем форму авторизации
|
// Изначально показываем форму авторизации
|
||||||
showLoginForm();
|
//showLoginForm();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -115,7 +115,7 @@
|
|||||||
location.href = location.href.replace(/^http:/, 'https:')
|
location.href = location.href.replace(/^http:/, 'https:')
|
||||||
}
|
}
|
||||||
|
|
||||||
var g_lng = /*[[${m_locale}]]*/ '';
|
var g_lng = [[${m_locale}]];
|
||||||
var g_map=null;
|
var g_map=null;
|
||||||
var m_winPP=null;
|
var m_winPP=null;
|
||||||
|
|
||||||
@ -540,21 +540,21 @@ if(g_lng=="1")
|
|||||||
|
|
||||||
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDVI();">
|
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDVI();">
|
||||||
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndvi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndvi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
||||||
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDVI</strong> <span th="${Normalized_difference_vegetation_index}">Normalized_difference_vegetation_index</span></div></div>
|
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDVI</strong> <span th:text="${Normalized_difference_vegetation_index}">Normalized_difference_vegetation_index</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpIVI();">
|
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpIVI();">
|
||||||
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ivi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ivi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
||||||
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>IVI</strong> <span th="${Integral_vegetation_index}">Integral_vegetation_index</span></div></div>
|
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>IVI</strong> <span th:text="${Integral_vegetation_index}">Integral_vegetation_index</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDWI();">
|
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDWI();">
|
||||||
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndwi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndwi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
||||||
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDWI</strong> <span th="${Normalized_difference_water_index}">Normalized_difference_water_index</span></div></div>
|
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDWI</strong> <span th:text="${Normalized_difference_water_index}">Normalized_difference_water_index</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDSI();">
|
<div style="cursor:pointer; height: 210px; background-color: #ffffff;margin-top:5px;margin-bottom:5px;box-shadow: 0 0 10px rgba(0,0,0,0.5);border-radius: 10px;" onclick="showPopUpNDSI();">
|
||||||
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndsi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
<div style="border-radius: 10px 10px 0px 0px; background-color: #aaa9a9; background-image: url('./resources/images/ndsi400.jpg'); background-repeat: no-repeat; background-position: center; width: 100%; height: 150px;"></div>
|
||||||
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDSI</strong> <span th="${Normalised_difference_snow_index}">Normalised_difference_snow_index</span></div></div>
|
<div style="border-radius: 0px 0px 10px 10px; background-color: #ffffff; width: 100%; height: 60px;position:relative;"><div style="position:absolute;top:50%;left:50%;-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);width:100%;"><strong>NDSI</strong> <span th:text="${Normalised_difference_snow_index}">Normalised_difference_snow_index</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user