mirror of https://github.com/acanas/swad-core.git
Version19.111.2
This commit is contained in:
parent
cc0ed5b7e4
commit
688b9050f5
|
@ -13106,5 +13106,12 @@ SELECT MIN(QstInd) FROM gam_questions WHERE GamCod=47 AND QstInd>5;
|
||||||
|
|
||||||
|
|
||||||
SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod,UNIX_TIMESTAMP(TimeNotif),Status FROM notif WHERE ToUsrCod=1346 ORDER BY TimeNotif DESC;
|
SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod,UNIX_TIMESTAMP(TimeNotif),Status FROM notif WHERE ToUsrCod=1346 ORDER BY TimeNotif DESC;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT AVG(Latitude),AVG(Longitude),MAX(MAX(Latitude)-MIN(Latitude),MAX(Longitude)-MIN(Longitude)) FROM centres WHERE InsCod=1 AND Latitude<>0 AND Longitude<>0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ static void CtrCfg_Map (void)
|
||||||
HTM_SCRIPT_Begin (NULL,NULL);
|
HTM_SCRIPT_Begin (NULL,NULL);
|
||||||
|
|
||||||
/* Let's create a map with pretty Mapbox Streets tiles */
|
/* Let's create a map with pretty Mapbox Streets tiles */
|
||||||
Map_CreateMap (CtrCfg_MAP_CONTAINER_ID,&Gbl.Hierarchy.Ctr.Coord);
|
Map_CreateMap (CtrCfg_MAP_CONTAINER_ID,&Gbl.Hierarchy.Ctr.Coord,16);
|
||||||
|
|
||||||
/* Add Mapbox Streets tile layer to our map */
|
/* Add Mapbox Streets tile layer to our map */
|
||||||
Map_AddTileLayer ();
|
Map_AddTileLayer ();
|
||||||
|
|
|
@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.111.1 (2020-01-03)"
|
#define Log_PLATFORM_VERSION "SWAD 19.111.2 (2020-01-03)"
|
||||||
#define CSS_FILE "swad19.111.css"
|
#define CSS_FILE "swad19.111.css"
|
||||||
#define JS_FILE "swad19.91.1.js"
|
#define JS_FILE "swad19.91.1.js"
|
||||||
/*
|
/*
|
||||||
|
@ -500,8 +500,8 @@ ps2pdf source.ps destination.pdf
|
||||||
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
||||||
// TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué?
|
// TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué?
|
||||||
// TODO: Version 19.1xx: Jan xx, 2020 Map in institution information. (? lines)
|
// TODO: Version 19.1xx: Jan xx, 2020 Map in institution information. (? lines)
|
||||||
// TODO: Fijar ampliación de mapa en institución
|
|
||||||
|
|
||||||
|
Version 19.111.2: Jan 03, 2020 Map in institution information. (278231 lines)
|
||||||
Version 19.111.1: Jan 03, 2020 Map in institution information. (278215 lines)
|
Version 19.111.1: Jan 03, 2020 Map in institution information. (278215 lines)
|
||||||
Version 19.111: Jan 03, 2020 Map in institution information. (278208 lines)
|
Version 19.111: Jan 03, 2020 Map in institution information. (278208 lines)
|
||||||
Version 19.110: Jan 03, 2020 Code refactoring in maps. (278160 lines)
|
Version 19.110: Jan 03, 2020 Code refactoring in maps. (278160 lines)
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void InsCfg_Configuration (bool PrintView);
|
||||||
static void InsCfg_PutIconsToPrintAndUpload (void);
|
static void InsCfg_PutIconsToPrintAndUpload (void);
|
||||||
static void InsCfg_Title (bool PutLink);
|
static void InsCfg_Title (bool PutLink);
|
||||||
static bool InsCfg_GetIfMapIsAvailable (void);
|
static bool InsCfg_GetIfMapIsAvailable (void);
|
||||||
static void InsCfg_GetAverageCoord (struct Coordinates *Coord);
|
static void InsCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom);
|
||||||
static void InsCfg_Map (void);
|
static void InsCfg_Map (void);
|
||||||
static void InsCfg_Country (bool PrintView,bool PutForm);
|
static void InsCfg_Country (bool PrintView,bool PutForm);
|
||||||
static void InsCfg_FullName (bool PutForm);
|
static void InsCfg_FullName (bool PutForm);
|
||||||
|
@ -252,21 +252,24 @@ static bool InsCfg_GetIfMapIsAvailable (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Check if centre map should be shown ********************/
|
/********* Get average coordinates of centres in current institution *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void InsCfg_GetAverageCoord (struct Coordinates *Coord)
|
static void InsCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
double MaxDistance;
|
||||||
|
|
||||||
/***** Get average coordinates of centres of current institution
|
/***** Get average coordinates of centres of current institution
|
||||||
with both coordinates set
|
with both coordinates set
|
||||||
(coordinates 0, 0 means not set ==> don't show map) *****/
|
(coordinates 0, 0 means not set ==> don't show map) *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get centres"
|
if (DB_QuerySELECT (&mysql_res,"can not get centres"
|
||||||
" with coordinates",
|
" with coordinates",
|
||||||
"SELECT AVG(Latitude)," // row[0]
|
"SELECT AVG(Latitude)," // row[0]
|
||||||
"AVG(Longitude)" // row[1]
|
"AVG(Longitude)," // row[1]
|
||||||
|
"GREATEST(MAX(Latitude)-MIN(Latitude),"
|
||||||
|
"MAX(Longitude)-MIN(Longitude))" // row[2]
|
||||||
" FROM centres"
|
" FROM centres"
|
||||||
" WHERE InsCod=%ld"
|
" WHERE InsCod=%ld"
|
||||||
" AND Latitude<>0"
|
" AND Latitude<>0"
|
||||||
|
@ -289,10 +292,22 @@ static void InsCfg_GetAverageCoord (struct Coordinates *Coord)
|
||||||
Coord->Longitude = -180.0; // West
|
Coord->Longitude = -180.0; // West
|
||||||
else if (Coord->Longitude > 180.0)
|
else if (Coord->Longitude > 180.0)
|
||||||
Coord->Longitude = 180.0; // East
|
Coord->Longitude = 180.0; // East
|
||||||
|
|
||||||
|
/* Get maximum distance (row[2]) */
|
||||||
|
MaxDistance = Str_GetDoubleFromStr (row[2]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Coord->Latitude =
|
Coord->Latitude =
|
||||||
Coord->Longitude = 0.0;
|
Coord->Longitude =
|
||||||
|
MaxDistance = 0.0;
|
||||||
|
|
||||||
|
/***** Convert distance to zoom *****/
|
||||||
|
*Zoom = (MaxDistance < 0.01) ? 16 :
|
||||||
|
((MaxDistance < 0.1 ) ? 12 :
|
||||||
|
((MaxDistance < 1.0 ) ? 8 :
|
||||||
|
((MaxDistance < 10.0 ) ? 6 :
|
||||||
|
((MaxDistance < 100.0 ) ? 3 :
|
||||||
|
1))));
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
@ -309,6 +324,7 @@ static void InsCfg_Map (void)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
struct Coordinates InsAvgCoord;
|
struct Coordinates InsAvgCoord;
|
||||||
|
unsigned Zoom;
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
struct Centre Ctr;
|
struct Centre Ctr;
|
||||||
|
@ -327,8 +343,8 @@ static void InsCfg_Map (void)
|
||||||
HTM_SCRIPT_Begin (NULL,NULL);
|
HTM_SCRIPT_Begin (NULL,NULL);
|
||||||
|
|
||||||
/* Let's create a map with pretty Mapbox Streets tiles */
|
/* Let's create a map with pretty Mapbox Streets tiles */
|
||||||
InsCfg_GetAverageCoord (&InsAvgCoord);
|
InsCfg_GetCoordAndZoom (&InsAvgCoord,&Zoom);
|
||||||
Map_CreateMap (InsCfg_MAP_CONTAINER_ID,&InsAvgCoord);
|
Map_CreateMap (InsCfg_MAP_CONTAINER_ID,&InsAvgCoord,Zoom);
|
||||||
|
|
||||||
/* Add Mapbox Streets tile layer to our map */
|
/* Add Mapbox Streets tile layer to our map */
|
||||||
Map_AddTileLayer ();
|
Map_AddTileLayer ();
|
||||||
|
|
|
@ -90,13 +90,14 @@ void Map_LeafletScript (void)
|
||||||
/************** Create a map centered in the given coordinates ***************/
|
/************** Create a map centered in the given coordinates ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Map_CreateMap (const char *ContainerId,const struct Coordinates *Coord)
|
void Map_CreateMap (const char *ContainerId,
|
||||||
|
const struct Coordinates *Coord,unsigned Zoom)
|
||||||
{
|
{
|
||||||
/* Let's create a map with pretty Mapbox Streets tiles */
|
/* Let's create a map with pretty Mapbox Streets tiles */
|
||||||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||||
HTM_TxtF ("\t"
|
HTM_TxtF ("\t"
|
||||||
"var mymap = L.map('%s').setView([%lg, %lg], 16);\n",
|
"var mymap = L.map('%s').setView([%lg, %lg], %u);\n",
|
||||||
ContainerId,Coord->Latitude,Coord->Longitude);
|
ContainerId,Coord->Latitude,Coord->Longitude,Zoom);
|
||||||
Str_SetDecimalPointToLocal (); // Return to local system
|
Str_SetDecimalPointToLocal (); // Return to local system
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ struct Coordinates
|
||||||
|
|
||||||
void Map_LeafletCSS (void);
|
void Map_LeafletCSS (void);
|
||||||
void Map_LeafletScript (void);
|
void Map_LeafletScript (void);
|
||||||
void Map_CreateMap (const char *ContainerId,const struct Coordinates *Coord);
|
void Map_CreateMap (const char *ContainerId,
|
||||||
|
const struct Coordinates *Coord,unsigned Zoom);
|
||||||
void Map_AddTileLayer (void);
|
void Map_AddTileLayer (void);
|
||||||
void Map_AddMarker (const struct Coordinates *Coord);
|
void Map_AddMarker (const struct Coordinates *Coord);
|
||||||
void Map_AddPopup (const char *Title,const char *Subtitle,bool Open);
|
void Map_AddPopup (const char *Title,const char *Subtitle,bool Open);
|
||||||
|
|
Loading…
Reference in New Issue