mirror of https://github.com/acanas/swad-core.git
Version 20.81: May 22, 2021 New module swad_country_database for database queries related to countries.
This commit is contained in:
parent
34fb16932c
commit
c1a0a2832b
3
Makefile
3
Makefile
|
@ -36,7 +36,8 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_agenda.o \
|
||||||
swad_center_config.o swad_chat.o swad_chat_database.o swad_config.o \
|
swad_center_config.o swad_chat.o swad_chat_database.o swad_config.o \
|
||||||
swad_connected.o swad_connected_database.o swad_cookie.o \
|
swad_connected.o swad_connected_database.o swad_cookie.o \
|
||||||
swad_cookie_database.o swad_country.o swad_country_config.o \
|
swad_cookie_database.o swad_country.o swad_country_config.o \
|
||||||
swad_course.o swad_course_config.o swad_cryptography.o \
|
swad_country_database.o swad_course.o swad_course_config.o \
|
||||||
|
swad_cryptography.o \
|
||||||
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
|
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
|
||||||
swad_degree_type.o swad_department.o swad_duplicate.o \
|
swad_degree_type.o swad_department.o swad_duplicate.o \
|
||||||
swad_enrolment.o swad_error.o swad_exam.o swad_exam_log.o \
|
swad_enrolment.o swad_error.o swad_exam.o swad_exam_log.o \
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct Ctr_Center
|
||||||
long PlcCod; // Place code
|
long PlcCod; // Place code
|
||||||
Ctr_Status_t Status; // Center status
|
Ctr_Status_t Status; // Center status
|
||||||
long RequesterUsrCod; // User code of the person who requested the creation of this center
|
long RequesterUsrCod; // User code of the person who requested the creation of this center
|
||||||
struct Coordinates Coord; // Geographical coordinates
|
struct Map_Coordinates Coord; // Geographical coordinates
|
||||||
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
|
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
|
||||||
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
|
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
|
||||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
|
|
|
@ -602,14 +602,15 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.80 (2021-05-20)"
|
#define Log_PLATFORM_VERSION "SWAD 20.81 (2021-05-22)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
Version 20.80: May 20, 2021 New module swad_cookie_database for database queries related to cookies. (? lines)
|
Version 20.81: May 22, 2021 New module swad_country_database for database queries related to countries. (311632 lines)
|
||||||
|
Version 20.80: May 20, 2021 New module swad_cookie_database for database queries related to cookies. (311497 lines)
|
||||||
Version 20.79: May 20, 2021 New module swad_connected_database for database queries related to connected users. (311415 lines)
|
Version 20.79: May 20, 2021 New module swad_connected_database for database queries related to connected users. (311415 lines)
|
||||||
Version 20.78.2: May 20, 2021 Code formatting in games and matches. (311326 lines)
|
Version 20.78.2: May 20, 2021 Code formatting in games and matches. (311326 lines)
|
||||||
Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (311317 lines)
|
Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (311317 lines)
|
||||||
|
|
966
swad_country.c
966
swad_country.c
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,8 @@
|
||||||
#include <stdlib.h> // For free
|
#include <stdlib.h> // For free
|
||||||
#include <string.h> // For string functions
|
#include <string.h> // For string functions
|
||||||
|
|
||||||
|
#include "swad_country_config.h"
|
||||||
|
#include "swad_country_database.h"
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_error.h"
|
#include "swad_error.h"
|
||||||
#include "swad_figure_cache.h"
|
#include "swad_figure_cache.h"
|
||||||
|
@ -67,7 +69,6 @@ extern struct Globals Gbl;
|
||||||
static void CtyCfg_Configuration (bool PrintView);
|
static void CtyCfg_Configuration (bool PrintView);
|
||||||
static void CtyCfg_PutIconToPrint (__attribute__((unused)) void *Args);
|
static void CtyCfg_PutIconToPrint (__attribute__((unused)) void *Args);
|
||||||
static void CtyCfg_Title (bool PutLink);
|
static void CtyCfg_Title (bool PutLink);
|
||||||
static void CtyCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom);
|
|
||||||
static void CtyCfg_Map (void);
|
static void CtyCfg_Map (void);
|
||||||
static void CtyCfg_MapImage (bool PrintView,bool PutLink);
|
static void CtyCfg_MapImage (bool PrintView,bool PutLink);
|
||||||
static void CtyCfg_Platform (bool PrintView);
|
static void CtyCfg_Platform (bool PrintView);
|
||||||
|
@ -138,68 +139,70 @@ static void CtyCfg_Configuration (bool PrintView)
|
||||||
/**************************** Left part ***********************************/
|
/**************************** Left part ***********************************/
|
||||||
HTM_DIV_Begin ("class=\"HIE_CFG_LEFT HIE_CFG_WIDTH\"");
|
HTM_DIV_Begin ("class=\"HIE_CFG_LEFT HIE_CFG_WIDTH\"");
|
||||||
|
|
||||||
/***** Begin table *****/
|
/* Begin table */
|
||||||
HTM_TABLE_BeginWidePadding (2);
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
|
||||||
/***** Platform *****/
|
/* Platform */
|
||||||
CtyCfg_Platform (PrintView);
|
CtyCfg_Platform (PrintView);
|
||||||
|
|
||||||
/***** Country name (an link to WWW if exists) *****/
|
/* Country name (an link to WWW if exists) */
|
||||||
CtyCfg_Name (PutLink);
|
CtyCfg_Name (PutLink);
|
||||||
|
|
||||||
/***** Shortcut to the country *****/
|
/* Shortcut to the country */
|
||||||
CtyCfg_Shortcut (PrintView);
|
CtyCfg_Shortcut (PrintView);
|
||||||
|
|
||||||
NumCtrsWithMap = Ctr_GetCachedNumCtrsWithMapInCty (Gbl.Hierarchy.Cty.CtyCod);
|
NumCtrsWithMap = Ctr_GetCachedNumCtrsWithMapInCty (Gbl.Hierarchy.Cty.CtyCod);
|
||||||
if (PrintView)
|
if (PrintView)
|
||||||
/***** QR code with link to the country *****/
|
/* QR code with link to the country */
|
||||||
CtyCfg_QR ();
|
CtyCfg_QR ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NumCtrs = Ctr_GetCachedNumCtrsInCty (Gbl.Hierarchy.Cty.CtyCod);
|
NumCtrs = Ctr_GetCachedNumCtrsInCty (Gbl.Hierarchy.Cty.CtyCod);
|
||||||
|
|
||||||
/***** Number of users who claim to belong to this country,
|
/* Number of users who claim to belong to this country,
|
||||||
number of institutions,
|
number of institutions,
|
||||||
number of centers,
|
number of centers,
|
||||||
number of degrees,
|
number of degrees,
|
||||||
number of courses *****/
|
number of courses */
|
||||||
CtyCfg_NumUsrs ();
|
CtyCfg_NumUsrs ();
|
||||||
CtyCfg_NumInss ();
|
CtyCfg_NumInss ();
|
||||||
HieCfg_NumCtrs (NumCtrs,
|
HieCfg_NumCtrs (NumCtrs,
|
||||||
false); // Don't put form
|
false); // Don't put form
|
||||||
HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap);
|
HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap);
|
||||||
CtyCfg_NumDegs ();
|
CtyCfg_NumDegs ();
|
||||||
CtyCfg_NumCrss ();
|
CtyCfg_NumCrss ();
|
||||||
|
|
||||||
/***** Number of users in courses of this country *****/
|
/* Number of users in courses of this country */
|
||||||
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_TCH);
|
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_TCH);
|
||||||
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_NET);
|
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_NET);
|
||||||
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_STD);
|
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_STD);
|
||||||
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_UNK);
|
HieCfg_NumUsrsInCrss (Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod,Rol_UNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/* End table */
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
/***** End of left part *****/
|
/* End of left part */
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/**************************** Right part **********************************/
|
/**************************** Right part **********************************/
|
||||||
/***** Check country map *****/
|
/* Check country map */
|
||||||
MapImageExists = Cty_CheckIfCountryPhotoExists (&Gbl.Hierarchy.Cty);
|
MapImageExists = Cty_CheckIfCountryPhotoExists (&Gbl.Hierarchy.Cty);
|
||||||
|
|
||||||
if (NumCtrsWithMap || MapImageExists)
|
if (NumCtrsWithMap || MapImageExists)
|
||||||
{
|
{
|
||||||
|
/* Begin container */
|
||||||
HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT HIE_CFG_WIDTH\"");
|
HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT HIE_CFG_WIDTH\"");
|
||||||
|
|
||||||
/***** Country map *****/
|
/* Country map */
|
||||||
if (NumCtrsWithMap)
|
if (NumCtrsWithMap)
|
||||||
CtyCfg_Map ();
|
CtyCfg_Map ();
|
||||||
|
|
||||||
/***** Country map image *****/
|
/* Country map image */
|
||||||
if (MapImageExists)
|
if (MapImageExists)
|
||||||
CtyCfg_MapImage (PrintView,PutLink);
|
CtyCfg_MapImage (PrintView,PutLink);
|
||||||
|
|
||||||
|
/* End container */
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,46 +226,27 @@ static void CtyCfg_PutIconToPrint (__attribute__((unused)) void *Args)
|
||||||
|
|
||||||
static void CtyCfg_Title (bool PutLink)
|
static void CtyCfg_Title (bool PutLink)
|
||||||
{
|
{
|
||||||
|
/***** Begin container *****/
|
||||||
HTM_DIV_Begin ("class=\"FRAME_TITLE FRAME_TITLE_BIG\"");
|
HTM_DIV_Begin ("class=\"FRAME_TITLE FRAME_TITLE_BIG\"");
|
||||||
if (PutLink)
|
|
||||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\""
|
/* Begin link */
|
||||||
" class=\"FRAME_TITLE_BIG\" title=\"%s\"",
|
if (PutLink)
|
||||||
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language],
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\""
|
||||||
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
" class=\"FRAME_TITLE_BIG\" title=\"%s\"",
|
||||||
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language],
|
||||||
if (PutLink)
|
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
||||||
HTM_A_End ();
|
|
||||||
|
/* Country name */
|
||||||
|
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
||||||
|
|
||||||
|
/* End link */
|
||||||
|
if (PutLink)
|
||||||
|
HTM_A_End ();
|
||||||
|
|
||||||
|
/***** End container *****/
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Get average coordinates of centers in current institution *********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void CtyCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
|
||||||
{
|
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get average coordinates of centers of current country
|
|
||||||
with both coordinates set
|
|
||||||
(coordinates 0, 0 means not set ==> don't show map) *****/
|
|
||||||
if (asprintf (&Query,
|
|
||||||
"SELECT AVG(ctr_centers.Latitude)," // row[0]
|
|
||||||
"AVG(ctr_centers.Longitude)," // row[1]
|
|
||||||
"GREATEST(MAX(ctr_centers.Latitude)-MIN(ctr_centers.Latitude),"
|
|
||||||
"MAX(ctr_centers.Longitude)-MIN(ctr_centers.Longitude))" // row[2]
|
|
||||||
" FROM ins_instits,"
|
|
||||||
"ctr_centers"
|
|
||||||
" WHERE ins_instits.CtyCod=%ld"
|
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
|
||||||
" AND ctr_centers.Latitude<>0"
|
|
||||||
" AND ctr_centers.Longitude<>0",
|
|
||||||
Gbl.Hierarchy.Cty.CtyCod) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
Map_GetCoordAndZoom (Coord,Zoom,Query);
|
|
||||||
free (Query);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Draw country map *****************************/
|
/****************************** Draw country map *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -272,7 +256,7 @@ static void CtyCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
||||||
static void CtyCfg_Map (void)
|
static void CtyCfg_Map (void)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
struct Coordinates CtyAvgCoord;
|
struct Map_Coordinates CtyAvgCoord;
|
||||||
unsigned Zoom;
|
unsigned Zoom;
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
|
@ -292,50 +276,41 @@ static void CtyCfg_Map (void)
|
||||||
/***** Script to draw the map *****/
|
/***** Script to draw the map *****/
|
||||||
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 */
|
||||||
CtyCfg_GetCoordAndZoom (&CtyAvgCoord,&Zoom);
|
Cty_DB_GetCoordAndZoom (&CtyAvgCoord,&Zoom);
|
||||||
Map_CreateMap (CtyCfg_MAP_CONTAINER_ID,&CtyAvgCoord,Zoom);
|
Map_CreateMap (CtyCfg_MAP_CONTAINER_ID,&CtyAvgCoord,Zoom);
|
||||||
|
|
||||||
/* Add Mapbox Streets tile layer to our map */
|
/* Add Mapbox Streets tile layer to our map */
|
||||||
Map_AddTileLayer ();
|
Map_AddTileLayer ();
|
||||||
|
|
||||||
/* Get centers with coordinates */
|
/* Get centers which have coordinates in the current country */
|
||||||
NumCtrs = (unsigned)
|
NumCtrs = Cty_DB_GetCtrsWithCoordsInCurrentCty (&mysql_res);
|
||||||
DB_QuerySELECT (&mysql_res,"can not get centers with coordinates",
|
|
||||||
"SELECT ctr_centers.CtrCod" // row[0]
|
|
||||||
" FROM ins_instits,"
|
|
||||||
"ctr_centers"
|
|
||||||
" WHERE ins_instits.CtyCod=%ld"
|
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
|
||||||
" AND ctr_centers.Latitude<>0"
|
|
||||||
" AND ctr_centers.Longitude<>0",
|
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
|
||||||
|
|
||||||
/* Add a marker and a popup for each center */
|
/* Add a marker and a popup for each center */
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < NumCtrs;
|
NumCtr < NumCtrs;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
{
|
{
|
||||||
/* Get next center */
|
/* Get next center */
|
||||||
Ctr.CtrCod = DB_GetNextCode (mysql_res);
|
Ctr.CtrCod = DB_GetNextCode (mysql_res);
|
||||||
|
|
||||||
/* Get data of center */
|
/* Get data of center */
|
||||||
Ctr_GetDataOfCenterByCod (&Ctr);
|
Ctr_GetDataOfCenterByCod (&Ctr);
|
||||||
|
|
||||||
/* Get data of institution */
|
/* Get data of institution */
|
||||||
Ins.InsCod = Ctr.InsCod;
|
Ins.InsCod = Ctr.InsCod;
|
||||||
Ins_GetDataOfInstitutionByCod (&Ins);
|
Ins_GetDataOfInstitutionByCod (&Ins);
|
||||||
|
|
||||||
/* Add marker */
|
/* Add marker */
|
||||||
Map_AddMarker (&Ctr.Coord);
|
Map_AddMarker (&Ctr.Coord);
|
||||||
|
|
||||||
/* Add popup */
|
/* Add popup */
|
||||||
Map_AddPopup (Ctr.ShrtName,Ins.ShrtName,
|
Map_AddPopup (Ctr.ShrtName,Ins.ShrtName,
|
||||||
false); // Closed
|
false); // Closed
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
/* Free structure that stores the query result */
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
HTM_SCRIPT_End ();
|
HTM_SCRIPT_End ();
|
||||||
}
|
}
|
||||||
|
@ -353,33 +328,33 @@ static void CtyCfg_MapImage (bool PrintView,bool PutLink)
|
||||||
|
|
||||||
/***** Map image *****/
|
/***** Map image *****/
|
||||||
HTM_DIV_Begin ("class=\"DAT_SMALL CM\"");
|
HTM_DIV_Begin ("class=\"DAT_SMALL CM\"");
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",
|
||||||
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language]);
|
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language]);
|
||||||
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,PrintView ? "COUNTRY_MAP_PRINT" :
|
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,PrintView ? "COUNTRY_MAP_PRINT" :
|
||||||
"COUNTRY_MAP_SHOW");
|
"COUNTRY_MAP_SHOW");
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
HTM_A_End ();
|
HTM_A_End ();
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/***** Map attribution *****/
|
/***** Map attribution *****/
|
||||||
if (!PrintView && Cty_CheckIfICanEditCountries ())
|
if (!PrintView && Cty_CheckIfICanEditCountries ())
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"CM\"");
|
HTM_DIV_Begin ("class=\"CM\"");
|
||||||
Frm_BeginForm (ActChgCtyMapAtt);
|
Frm_BeginForm (ActChgCtyMapAtt);
|
||||||
HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"3\""
|
HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"3\""
|
||||||
" onchange=\"document.getElementById('%s').submit();return false;\"",
|
" onchange=\"document.getElementById('%s').submit();return false;\"",
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
if (MapAttribution)
|
if (MapAttribution)
|
||||||
HTM_Txt (MapAttribution);
|
HTM_Txt (MapAttribution);
|
||||||
HTM_TEXTAREA_End ();
|
HTM_TEXTAREA_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
else if (MapAttribution)
|
else if (MapAttribution)
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"ATTRIBUTION\"");
|
HTM_DIV_Begin ("class=\"ATTRIBUTION\"");
|
||||||
HTM_Txt (MapAttribution);
|
HTM_Txt (MapAttribution);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,27 +373,27 @@ static void CtyCfg_Platform (bool PrintView)
|
||||||
/***** Institution *****/
|
/***** Institution *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Platform);
|
Frm_LabelColumn ("RT",NULL,Txt_Platform);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
if (!PrintView)
|
if (!PrintView)
|
||||||
{
|
{
|
||||||
Frm_BeginFormGoTo (ActSeeSysInf);
|
Frm_BeginFormGoTo (ActSeeSysInf);
|
||||||
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Cfg_PLATFORM_SHORT_NAME),
|
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Cfg_PLATFORM_SHORT_NAME),
|
||||||
"BT_LINK LT DAT",NULL);
|
"BT_LINK LT DAT",NULL);
|
||||||
Hie_FreeGoToMsg ();
|
Hie_FreeGoToMsg ();
|
||||||
}
|
}
|
||||||
Ico_PutIcon ("swad64x64.png",Cfg_PLATFORM_FULL_NAME,"ICO20x20");
|
Ico_PutIcon ("swad64x64.png",Cfg_PLATFORM_FULL_NAME,"ICO20x20");
|
||||||
HTM_NBSP ();
|
HTM_NBSP ();
|
||||||
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
|
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
|
||||||
if (!PrintView)
|
if (!PrintView)
|
||||||
{
|
{
|
||||||
HTM_BUTTON_End ();
|
HTM_BUTTON_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -434,18 +409,18 @@ static void CtyCfg_Name (bool PutLink)
|
||||||
/***** Country name *****/
|
/***** Country name *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Country);
|
Frm_LabelColumn ("RT",NULL,Txt_Country);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT_N LB\"");
|
HTM_TD_Begin ("class=\"DAT_N LB\"");
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
||||||
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language]);
|
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language]);
|
||||||
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
HTM_A_End ();
|
HTM_A_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -479,13 +454,13 @@ static void CtyCfg_NumUsrs (void)
|
||||||
/***** Number of users *****/
|
/***** Number of users *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Users_of_the_country);
|
Frm_LabelColumn ("RT",NULL,Txt_Users_of_the_country);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Usr_GetCachedNumUsrsWhoClaimToBelongToCty (&Gbl.Hierarchy.Cty));
|
HTM_Unsigned (Usr_GetCachedNumUsrsWhoClaimToBelongToCty (&Gbl.Hierarchy.Cty));
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -502,21 +477,21 @@ static void CtyCfg_NumInss (void)
|
||||||
/***** Number of institutions ******/
|
/***** Number of institutions ******/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Institutions);
|
Frm_LabelColumn ("RT",NULL,Txt_Institutions);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LB\"");
|
HTM_TD_Begin ("class=\"LB\"");
|
||||||
Frm_BeginFormGoTo (ActSeeIns);
|
Frm_BeginFormGoTo (ActSeeIns);
|
||||||
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
|
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
|
||||||
HTM_BUTTON_SUBMIT_Begin (Str_BuildStringStr (Txt_Institutions_of_COUNTRY_X,
|
HTM_BUTTON_SUBMIT_Begin (Str_BuildStringStr (Txt_Institutions_of_COUNTRY_X,
|
||||||
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]),
|
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]),
|
||||||
"BT_LINK DAT",NULL);
|
"BT_LINK DAT",NULL);
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
HTM_Unsigned (Ins_GetCachedNumInssInCty (Gbl.Hierarchy.Cty.CtyCod));
|
HTM_Unsigned (Ins_GetCachedNumInssInCty (Gbl.Hierarchy.Cty.CtyCod));
|
||||||
HTM_BUTTON_End ();
|
HTM_BUTTON_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -532,13 +507,13 @@ static void CtyCfg_NumDegs (void)
|
||||||
/***** Number of degrees *****/
|
/***** Number of degrees *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Degrees);
|
Frm_LabelColumn ("RT",NULL,Txt_Degrees);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Deg_GetCachedNumDegsInCty (Gbl.Hierarchy.Cty.CtyCod));
|
HTM_Unsigned (Deg_GetCachedNumDegsInCty (Gbl.Hierarchy.Cty.CtyCod));
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -554,13 +529,13 @@ static void CtyCfg_NumCrss (void)
|
||||||
/***** Number of courses *****/
|
/***** Number of courses *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",NULL,Txt_Courses);
|
Frm_LabelColumn ("RT",NULL,Txt_Courses);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Crs_GetCachedNumCrssInCty (Gbl.Hierarchy.Cty.CtyCod));
|
HTM_Unsigned (Crs_GetCachedNumCrssInCty (Gbl.Hierarchy.Cty.CtyCod));
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -578,12 +553,8 @@ static void CtyCfg_GetMapAttr (long CtyCod,char **MapAttribution)
|
||||||
/***** Free possible former map attribution *****/
|
/***** Free possible former map attribution *****/
|
||||||
CtyCfg_FreeMapAttr (MapAttribution);
|
CtyCfg_FreeMapAttr (MapAttribution);
|
||||||
|
|
||||||
/***** Get photo attribution from database *****/
|
/***** Get map attribution from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get photo attribution",
|
if (Cty_DB_GetMapAttr (&mysql_res,CtyCod))
|
||||||
"SELECT MapAttribution" // row[0]
|
|
||||||
" FROM cty_countrs"
|
|
||||||
" WHERE CtyCod=%ld",
|
|
||||||
CtyCod))
|
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -628,13 +599,8 @@ void CtyCfg_ChangeCtyMapAttr (void)
|
||||||
/* Get the new map attribution for the country */
|
/* Get the new map attribution for the country */
|
||||||
Par_GetParToText ("Attribution",NewMapAttribution,Med_MAX_BYTES_ATTRIBUTION);
|
Par_GetParToText ("Attribution",NewMapAttribution,Med_MAX_BYTES_ATTRIBUTION);
|
||||||
|
|
||||||
/***** Update the table changing old attribution by new attribution *****/
|
/***** Change old attribution by new attribution in database *****/
|
||||||
DB_QueryUPDATE ("can not update the map attribution of a country",
|
Cty_DB_UpdateCtyMapAttr (NewMapAttribution);
|
||||||
"UPDATE cty_countrs"
|
|
||||||
" SET MapAttribution='%s'"
|
|
||||||
" WHERE CtyCod='%03ld'",
|
|
||||||
NewMapAttribution,
|
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
|
||||||
|
|
||||||
/***** Show the country information again *****/
|
/***** Show the country information again *****/
|
||||||
CtyCfg_ShowConfiguration ();
|
CtyCfg_ShowConfiguration ();
|
||||||
|
|
|
@ -0,0 +1,257 @@
|
||||||
|
// swad_country_database.h: countries operations with database
|
||||||
|
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE // For asprintf
|
||||||
|
// #include <stdbool.h> // For boolean type
|
||||||
|
// #include <stddef.h> // For NULL
|
||||||
|
#include <stdio.h> // For asprintf
|
||||||
|
// #include <stdlib.h> // For free
|
||||||
|
// #include <string.h> // For string functions
|
||||||
|
|
||||||
|
#include "swad_country_database.h"
|
||||||
|
#include "swad_database.h"
|
||||||
|
#include "swad_error.h"
|
||||||
|
#include "swad_global.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** External global variables from others modules ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
extern struct Globals Gbl;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Private constants *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************************* Private types *******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Private variables *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Private prototypes ****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********** Get basic list of countries ordered by name of country ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetBasicListOfCountries (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||||
|
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get countries",
|
||||||
|
"SELECT CtyCod," // row[0]
|
||||||
|
"Name_%s" // row[1]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" ORDER BY Name_%s",
|
||||||
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Get countries with pending institutions *****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetListOfCountriesWithPendingInss (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||||
|
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get countries"
|
||||||
|
" with pending institutions",
|
||||||
|
"SELECT ins_instits.CtyCod," // row[0]
|
||||||
|
"COUNT(*)" // row[1]
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"cty_countrs"
|
||||||
|
" WHERE (ins_instits.Status & %u)<>0"
|
||||||
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
|
" GROUP BY ins_instits.CtyCod"
|
||||||
|
" ORDER BY cty_countrs.Name_%s",
|
||||||
|
(unsigned) Ins_STATUS_BIT_PENDING,
|
||||||
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********** Get full list of countries with names in all languages ***********/
|
||||||
|
/********** and number of users who claim to belong to them ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define Cty_MAX_BYTES_SUBQUERY_CTYS ((1 + Lan_NUM_LANGUAGES) * 32)
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetFullListOfCountries (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||||
|
char StrField[32];
|
||||||
|
char SubQueryNam1[Cty_MAX_BYTES_SUBQUERY_CTYS + 1];
|
||||||
|
char SubQueryNam2[Cty_MAX_BYTES_SUBQUERY_CTYS + 1];
|
||||||
|
char SubQueryWWW1[Cty_MAX_BYTES_SUBQUERY_CTYS + 1];
|
||||||
|
char SubQueryWWW2[Cty_MAX_BYTES_SUBQUERY_CTYS + 1];
|
||||||
|
char *OrderBySubQuery = NULL;
|
||||||
|
static const char *OrderBySubQueryFmt[Cty_NUM_ORDERS] =
|
||||||
|
{
|
||||||
|
[Cty_ORDER_BY_COUNTRY ] = "Name_%s",
|
||||||
|
[Cty_ORDER_BY_NUM_USRS] = "NumUsrs DESC,Name_%s",
|
||||||
|
};
|
||||||
|
unsigned NumCtys;
|
||||||
|
Lan_Language_t Lan;
|
||||||
|
|
||||||
|
/***** Get countries from database *****/
|
||||||
|
SubQueryNam1[0] = '\0';
|
||||||
|
SubQueryNam2[0] = '\0';
|
||||||
|
SubQueryWWW1[0] = '\0';
|
||||||
|
SubQueryWWW2[0] = '\0';
|
||||||
|
for (Lan = (Lan_Language_t) 1;
|
||||||
|
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
|
||||||
|
Lan++)
|
||||||
|
{
|
||||||
|
snprintf (StrField,sizeof (StrField),"cty_countrs.Name_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
|
Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1);
|
||||||
|
snprintf (StrField,sizeof (StrField),"Name_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
|
Str_Concat (SubQueryNam2,StrField,sizeof (SubQueryNam2) - 1);
|
||||||
|
|
||||||
|
snprintf (StrField,sizeof (StrField),"cty_countrs.WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
|
Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1);
|
||||||
|
snprintf (StrField,sizeof (StrField),"WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
|
Str_Concat (SubQueryWWW2,StrField,sizeof (SubQueryWWW2) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Build order subquery */
|
||||||
|
if (asprintf (&OrderBySubQuery,OrderBySubQueryFmt[Gbl.Hierarchy.Ctys.SelectedOrder],
|
||||||
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/* Query database */
|
||||||
|
NumCtys = (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get countries",
|
||||||
|
"(SELECT cty_countrs.CtyCod," // row[0]
|
||||||
|
"cty_countrs.Alpha2," // row[1]
|
||||||
|
"%s" // row[...]
|
||||||
|
"%s" // row[...]
|
||||||
|
"COUNT(*) AS NumUsrs" // row[...]
|
||||||
|
" FROM cty_countrs,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE cty_countrs.CtyCod=usr_data.CtyCod"
|
||||||
|
" GROUP BY cty_countrs.CtyCod)"
|
||||||
|
" UNION "
|
||||||
|
"(SELECT CtyCod," // row[0]
|
||||||
|
"Alpha2," // row[1]
|
||||||
|
"%s" // row[...]
|
||||||
|
"%s" // row[...]
|
||||||
|
"0 AS NumUsrs" // row[...]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" WHERE CtyCod NOT IN"
|
||||||
|
" (SELECT DISTINCT CtyCod"
|
||||||
|
" FROM usr_data))"
|
||||||
|
" ORDER BY %s",
|
||||||
|
SubQueryNam1,SubQueryWWW1,
|
||||||
|
SubQueryNam2,SubQueryWWW2,OrderBySubQuery);
|
||||||
|
|
||||||
|
/* Free memory for subquery */
|
||||||
|
free (OrderBySubQuery);
|
||||||
|
|
||||||
|
return NumCtys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get average coordinates of centers in current country ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Cty_DB_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom)
|
||||||
|
{
|
||||||
|
char *Query;
|
||||||
|
|
||||||
|
/***** Get average coordinates of centers of current country
|
||||||
|
with both coordinates set
|
||||||
|
(coordinates 0, 0 means not set ==> don't show map) *****/
|
||||||
|
if (asprintf (&Query,
|
||||||
|
"SELECT AVG(ctr_centers.Latitude)," // row[0]
|
||||||
|
"AVG(ctr_centers.Longitude)," // row[1]
|
||||||
|
"GREATEST(MAX(ctr_centers.Latitude)-MIN(ctr_centers.Latitude),"
|
||||||
|
"MAX(ctr_centers.Longitude)-MIN(ctr_centers.Longitude))" // row[2]
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"ctr_centers"
|
||||||
|
" WHERE ins_instits.CtyCod=%ld"
|
||||||
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
|
" AND ctr_centers.Latitude<>0"
|
||||||
|
" AND ctr_centers.Longitude<>0",
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Map_GetCoordAndZoom (Coord,Zoom,Query);
|
||||||
|
free (Query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get centres which have coordinates in current country ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetCtrsWithCoordsInCurrentCty (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get centers with coordinates",
|
||||||
|
"SELECT ctr_centers.CtrCod"
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"ctr_centers"
|
||||||
|
" WHERE ins_instits.CtyCod=%ld"
|
||||||
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
|
" AND ctr_centers.Latitude<>0"
|
||||||
|
" AND ctr_centers.Longitude<>0",
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Get map attribution from database **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetMapAttr (MYSQL_RES **mysql_res,long CtyCod)
|
||||||
|
{
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get map attribution",
|
||||||
|
"SELECT MapAttribution" // row[0]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" WHERE CtyCod=%ld",
|
||||||
|
CtyCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Update the attribution of the map of current country ************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Cty_DB_UpdateCtyMapAttr (const char NewMapAttribution[Med_MAX_BYTES_ATTRIBUTION + 1])
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not update the map attribution",
|
||||||
|
"UPDATE cty_countrs"
|
||||||
|
" SET MapAttribution='%s'"
|
||||||
|
" WHERE CtyCod='%03ld'",
|
||||||
|
NewMapAttribution,
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
// swad_country_database.h: countries operations with database
|
||||||
|
|
||||||
|
#ifndef _SWAD_CTY_DB
|
||||||
|
#define _SWAD_CTY_DB
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance in Spanish),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <mysql/mysql.h> // To access MySQL databases
|
||||||
|
|
||||||
|
#include "swad_map.h"
|
||||||
|
#include "swad_media.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Public types and constants ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Public prototypes *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Cty_DB_GetBasicListOfCountries (MYSQL_RES **mysql_res);
|
||||||
|
unsigned Cty_DB_GetListOfCountriesWithPendingInss (MYSQL_RES **mysql_res);
|
||||||
|
unsigned Cty_DB_GetFullListOfCountries (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
|
void Cty_DB_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom);
|
||||||
|
unsigned Cty_DB_GetCtrsWithCoordsInCurrentCty (MYSQL_RES **mysql_res);
|
||||||
|
unsigned Cty_DB_GetMapAttr (MYSQL_RES **mysql_res,long CtyCod);
|
||||||
|
void Cty_DB_UpdateCtyMapAttr (const char NewMapAttribution[Med_MAX_BYTES_ATTRIBUTION + 1]);
|
||||||
|
|
||||||
|
#endif
|
126
swad_hierarchy.c
126
swad_hierarchy.c
|
@ -93,87 +93,87 @@ void Hie_WriteMenuHierarchy (void)
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginCenterPadding (2);
|
HTM_TABLE_BeginCenterPadding (2);
|
||||||
|
|
||||||
/***** Write a 1st selector
|
/***** Write a 1st selector
|
||||||
with all the countries *****/
|
with all the countries *****/
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/* Label */
|
|
||||||
Frm_LabelColumn ("RT","cty",Txt_Country);
|
|
||||||
|
|
||||||
/* Data */
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
Cty_WriteSelectorOfCountry ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
if (Gbl.Hierarchy.Cty.CtyCod > 0)
|
|
||||||
{
|
|
||||||
/***** Write a 2nd selector
|
|
||||||
with the institutions of selected country *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","ins",Txt_Institution);
|
Frm_LabelColumn ("RT","cty",Txt_Country);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
Ins_WriteSelectorOfInstitution ();
|
Cty_WriteSelectorOfCountry ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
if (Gbl.Hierarchy.Ins.InsCod > 0)
|
if (Gbl.Hierarchy.Cty.CtyCod > 0)
|
||||||
{
|
{
|
||||||
/***** Write a 3rd selector
|
/***** Write a 2nd selector
|
||||||
with all the centers of selected institution *****/
|
with the institutions of selected country *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","ctr",Txt_Center);
|
Frm_LabelColumn ("RT","ins",Txt_Institution);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
Ctr_WriteSelectorOfCenter ();
|
Ins_WriteSelectorOfInstitution ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
|
if (Gbl.Hierarchy.Ins.InsCod > 0)
|
||||||
{
|
{
|
||||||
/***** Write a 4th selector
|
/***** Write a 3rd selector
|
||||||
with all the degrees of selected center *****/
|
with all the centers of selected institution *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
|
||||||
Frm_LabelColumn ("RT","deg",Txt_Degree);
|
|
||||||
|
|
||||||
/* Data */
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
Deg_WriteSelectorOfDegree ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
if (Gbl.Hierarchy.Deg.DegCod > 0)
|
|
||||||
{
|
|
||||||
/***** Write a 5th selector
|
|
||||||
with all the courses of selected degree *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","crs",Txt_Course);
|
Frm_LabelColumn ("RT","ctr",Txt_Center);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
Crs_WriteSelectorOfCourse ();
|
Ctr_WriteSelectorOfCenter ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
|
||||||
|
{
|
||||||
|
/***** Write a 4th selector
|
||||||
|
with all the degrees of selected center *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Label */
|
||||||
|
Frm_LabelColumn ("RT","deg",Txt_Degree);
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
Deg_WriteSelectorOfDegree ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
if (Gbl.Hierarchy.Deg.DegCod > 0)
|
||||||
|
{
|
||||||
|
/***** Write a 5th selector
|
||||||
|
with all the courses of selected degree *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Label */
|
||||||
|
Frm_LabelColumn ("RT","crs",Txt_Course);
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
Crs_WriteSelectorOfCourse ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
|
@ -70,7 +70,7 @@ extern struct Globals Gbl;
|
||||||
static void InsCfg_Configuration (bool PrintView);
|
static void InsCfg_Configuration (bool PrintView);
|
||||||
static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args);
|
static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args);
|
||||||
static void InsCfg_Title (bool PutLink);
|
static void InsCfg_Title (bool PutLink);
|
||||||
static void InsCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom);
|
static void InsCfg_GetCoordAndZoom (struct Map_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);
|
||||||
|
@ -248,7 +248,7 @@ static void InsCfg_Title (bool PutLink)
|
||||||
/********* Get average coordinates of centers in current institution *********/
|
/********* Get average coordinates of centers in current institution *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void InsCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
static void InsCfg_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom)
|
||||||
{
|
{
|
||||||
char *Query;
|
char *Query;
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ static void InsCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
||||||
static void InsCfg_Map (void)
|
static void InsCfg_Map (void)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
struct Coordinates InsAvgCoord;
|
struct Map_Coordinates InsAvgCoord;
|
||||||
unsigned Zoom;
|
unsigned Zoom;
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
|
@ -349,60 +349,59 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
|
||||||
extern const char *Txt_Country;
|
extern const char *Txt_Country;
|
||||||
unsigned NumCty;
|
unsigned NumCty;
|
||||||
|
|
||||||
|
/***** Get list of countries *****/
|
||||||
|
Cty_GetBasicListOfCountries ();
|
||||||
|
|
||||||
/***** Country *****/
|
/***** Country *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT",PutForm ? "OthCtyCod" :
|
Frm_LabelColumn ("RT",PutForm ? "OthCtyCod" :
|
||||||
NULL,
|
NULL,
|
||||||
Txt_Country);
|
Txt_Country);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
if (PutForm)
|
if (PutForm)
|
||||||
{
|
{
|
||||||
/* Get list of countries */
|
/* Put form to select country */
|
||||||
Cty_GetBasicListOfCountries ();
|
Frm_BeginForm (ActChgInsCtyCfg);
|
||||||
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||||
/* Put form to select country */
|
"id=\"OthCtyCod\" name=\"OthCtyCod\""
|
||||||
Frm_BeginForm (ActChgInsCtyCfg);
|
" class=\"INPUT_SHORT_NAME\"");
|
||||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
for (NumCty = 0;
|
||||||
"id=\"OthCtyCod\" name=\"OthCtyCod\""
|
NumCty < Gbl.Hierarchy.Ctys.Num;
|
||||||
" class=\"INPUT_SHORT_NAME\"");
|
NumCty++)
|
||||||
for (NumCty = 0;
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
||||||
NumCty < Gbl.Hierarchy.Ctys.Num;
|
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod,false,
|
||||||
NumCty++)
|
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
HTM_SELECT_End ();
|
||||||
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod,false,
|
Frm_EndForm ();
|
||||||
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
}
|
||||||
HTM_SELECT_End ();
|
else // I can not move institution to another country
|
||||||
Frm_EndForm ();
|
{
|
||||||
|
if (!PrintView)
|
||||||
/* Free list of countries */
|
{
|
||||||
Cty_FreeListCountries ();
|
Frm_BeginFormGoTo (ActSeeCtyInf);
|
||||||
}
|
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
|
||||||
else // I can not move institution to another country
|
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]),
|
||||||
{
|
"BT_LINK LT DAT",NULL);
|
||||||
if (!PrintView)
|
Hie_FreeGoToMsg ();
|
||||||
{
|
}
|
||||||
Frm_BeginFormGoTo (ActSeeCtyInf);
|
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TINY");
|
||||||
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
|
HTM_NBSP ();
|
||||||
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]),
|
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
||||||
"BT_LINK LT DAT",NULL);
|
if (!PrintView)
|
||||||
Hie_FreeGoToMsg ();
|
{
|
||||||
}
|
HTM_BUTTON_End ();
|
||||||
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TINY");
|
Frm_EndForm ();
|
||||||
HTM_NBSP ();
|
}
|
||||||
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
}
|
||||||
if (!PrintView)
|
HTM_TD_End ();
|
||||||
{
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
// Do not free list of countries here, because it can be reused
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -89,7 +89,7 @@ void Map_LeafletScript (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Map_CreateMap (const char *ContainerId,
|
void Map_CreateMap (const char *ContainerId,
|
||||||
const struct Coordinates *Coord,unsigned Zoom)
|
const struct Map_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
|
||||||
|
@ -136,7 +136,7 @@ void Map_AddTileLayer (void)
|
||||||
/************************** Add a marker to our map **************************/
|
/************************** Add a marker to our map **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Map_AddMarker (const struct Coordinates *Coord)
|
void Map_AddMarker (const struct Map_Coordinates *Coord)
|
||||||
{
|
{
|
||||||
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"
|
||||||
|
@ -167,7 +167,7 @@ void Map_AddPopup (const char *Title,const char *Subtitle,bool Open)
|
||||||
/********* Get average coordinates of centers in current institution *********/
|
/********* Get average coordinates of centers in current institution *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Map_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom,
|
void Map_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom,
|
||||||
const char *Query)
|
const char *Query)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
|
10
swad_map.h
10
swad_map.h
|
@ -27,11 +27,13 @@
|
||||||
/********************************* Headers ***********************************/
|
/********************************* Headers ***********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdbool.h> // For boolean type
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
struct Coordinates
|
struct Map_Coordinates
|
||||||
{
|
{
|
||||||
double Latitude;
|
double Latitude;
|
||||||
double Longitude;
|
double Longitude;
|
||||||
|
@ -45,11 +47,11 @@ struct Coordinates
|
||||||
void Map_LeafletCSS (void);
|
void Map_LeafletCSS (void);
|
||||||
void Map_LeafletScript (void);
|
void Map_LeafletScript (void);
|
||||||
void Map_CreateMap (const char *ContainerId,
|
void Map_CreateMap (const char *ContainerId,
|
||||||
const struct Coordinates *Coord,unsigned Zoom);
|
const struct Map_Coordinates *Coord,unsigned Zoom);
|
||||||
void Map_AddTileLayer (void);
|
void Map_AddTileLayer (void);
|
||||||
void Map_AddMarker (const struct Coordinates *Coord);
|
void Map_AddMarker (const struct Map_Coordinates *Coord);
|
||||||
void Map_AddPopup (const char *Title,const char *Subtitle,bool Open);
|
void Map_AddPopup (const char *Title,const char *Subtitle,bool Open);
|
||||||
void Map_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom,
|
void Map_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom,
|
||||||
const char *Query);
|
const char *Query);
|
||||||
double Map_GetLatitudeFromStr (char *Str);
|
double Map_GetLatitudeFromStr (char *Str);
|
||||||
double Map_GetLongitudeFromStr (char *Str);
|
double Map_GetLongitudeFromStr (char *Str);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <mysql/mysql.h> // To access MySQL databases
|
#include <mysql/mysql.h> // To access MySQL databases
|
||||||
|
|
||||||
#include "swad_cryptography.h"
|
#include "swad_cryptography.h"
|
||||||
|
#include "swad_string.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Public constants ******************************/
|
/***************************** Public constants ******************************/
|
||||||
|
|
421
swad_record.c
421
swad_record.c
|
@ -3278,41 +3278,42 @@ static void Rec_ShowCountry (struct UsrData *UsrDat,bool PutForm)
|
||||||
unsigned NumCty;
|
unsigned NumCty;
|
||||||
|
|
||||||
/***** If list of countries is empty, try to get it *****/
|
/***** If list of countries is empty, try to get it *****/
|
||||||
if (!Gbl.Hierarchy.Ctys.Num)
|
Cty_GetBasicListOfCountries ();
|
||||||
Cty_GetBasicListOfCountries ();
|
|
||||||
|
|
||||||
/***** Selector of country *****/
|
/***** Selector of country *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
if (PutForm)
|
if (PutForm)
|
||||||
{
|
{
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","OthCtyCod",
|
Frm_LabelColumn ("REC_C1_BOT RM","OthCtyCod",
|
||||||
Str_BuildStringStr ("%s*",Txt_Country));
|
Str_BuildStringStr ("%s*",Txt_Country));
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Country);
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Country);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"REC_C2_BOT LM\"");
|
||||||
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"OthCtyCod\" name=\"OthCtyCod\""
|
"id=\"OthCtyCod\" name=\"OthCtyCod\""
|
||||||
" class=\"REC_C2_BOT_INPUT\" required=\"required\"");
|
" class=\"REC_C2_BOT_INPUT\" required=\"required\"");
|
||||||
HTM_OPTION (HTM_Type_STRING,"",false,false,
|
HTM_OPTION (HTM_Type_STRING,"",false,false,
|
||||||
"%s",Txt_Country);
|
"%s",Txt_Country);
|
||||||
HTM_OPTION (HTM_Type_STRING,"0",UsrDat->CtyCod == 0,false,
|
HTM_OPTION (HTM_Type_STRING,"0",UsrDat->CtyCod == 0,false,
|
||||||
"%s",Txt_Another_country);
|
"%s",Txt_Another_country);
|
||||||
for (NumCty = 0;
|
for (NumCty = 0;
|
||||||
NumCty < Gbl.Hierarchy.Ctys.Num;
|
NumCty < Gbl.Hierarchy.Ctys.Num;
|
||||||
NumCty++)
|
NumCty++)
|
||||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
||||||
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod,false,
|
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod,false,
|
||||||
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||||
HTM_SELECT_End ();
|
HTM_SELECT_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
// Do not free here list of countries, because it can be reused
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3476,22 +3477,22 @@ static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData)
|
||||||
/***** Institution *****/
|
/***** Institution *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Institution);
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Institution);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
||||||
if (ShowData)
|
if (ShowData)
|
||||||
if (Ins->InsCod > 0)
|
if (Ins->InsCod > 0)
|
||||||
{
|
{
|
||||||
if (Ins->WWW[0])
|
if (Ins->WWW[0])
|
||||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
||||||
Ins->WWW);
|
Ins->WWW);
|
||||||
HTM_Txt (Ins->FullName);
|
HTM_Txt (Ins->FullName);
|
||||||
if (Ins->WWW[0])
|
if (Ins->WWW[0])
|
||||||
HTM_A_End ();
|
HTM_A_End ();
|
||||||
}
|
}
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -3815,26 +3816,28 @@ void Rec_ShowMySharedRecordAndMore (void)
|
||||||
/***** Begin container *****/
|
/***** Begin container *****/
|
||||||
HTM_DIV_Begin ("class=\"REC_USR\"");
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
||||||
|
|
||||||
/***** Left part *****/
|
/***** Left part *****/
|
||||||
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
/* Begin container for left part */
|
||||||
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
||||||
|
|
||||||
/* My shared record card */
|
/* My shared record card */
|
||||||
Rec_ShowSharedUsrRecord (Rec_SHA_MY_RECORD_FORM,&Gbl.Usrs.Me.UsrDat,NULL);
|
Rec_ShowSharedUsrRecord (Rec_SHA_MY_RECORD_FORM,&Gbl.Usrs.Me.UsrDat,NULL);
|
||||||
|
|
||||||
HTM_DIV_End ();
|
/* End container for left part */
|
||||||
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/***** Right part *****/
|
/***** Right part *****/
|
||||||
/* Begin container for right part */
|
/* Begin container for right part */
|
||||||
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
||||||
|
|
||||||
/* My institution, center and department */
|
/* My institution, center and department */
|
||||||
Rec_ShowFormMyInsCtrDpt (IAmATeacher);
|
Rec_ShowFormMyInsCtrDpt (IAmATeacher);
|
||||||
|
|
||||||
/* My webs / social networks */
|
/* My webs / social networks */
|
||||||
Net_ShowFormMyWebsAndSocialNets ();
|
Net_ShowFormMyWebsAndSocialNets ();
|
||||||
|
|
||||||
/* End container for right part */
|
/* End container for right part */
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/***** End container *****/
|
/***** End container *****/
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
@ -3865,194 +3868,196 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||||
|
|
||||||
|
/***** Get list of countries *****/
|
||||||
|
Cty_GetBasicListOfCountries ();
|
||||||
|
|
||||||
/***** Begin section *****/
|
/***** Begin section *****/
|
||||||
HTM_SECTION_Begin (Rec_MY_INS_CTR_DPT_ID);
|
HTM_SECTION_Begin (Rec_MY_INS_CTR_DPT_ID);
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||||
Box_BoxTableBegin (StrRecordWidth,
|
Box_BoxTableBegin (StrRecordWidth,
|
||||||
IAmATeacher ? Txt_Institution_center_and_department :
|
IAmATeacher ? Txt_Institution_center_and_department :
|
||||||
Txt_Institution,
|
Txt_Institution,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_PROFILE_Institution,Box_NOT_CLOSABLE,2);
|
Hlp_PROFILE_Institution,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Country *****/
|
/***** Country *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","InsCtyCod",
|
Frm_LabelColumn ("REC_C1_BOT RM","InsCtyCod",
|
||||||
Str_BuildStringStr ("%s*",Txt_Country));
|
Str_BuildStringStr ("%s*",Txt_Country));
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
|
|
||||||
/* If list of countries is empty, try to get it */
|
/* Begin form to select the country of my institution */
|
||||||
if (!Gbl.Hierarchy.Ctys.Num)
|
Frm_StartFormAnchor (ActChgCtyMyIns,Rec_MY_INS_CTR_DPT_ID);
|
||||||
Cty_GetBasicListOfCountries ();
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||||
|
"id=\"InsCtyCod\" name=\"OthCtyCod\""
|
||||||
|
" class=\"REC_C2_BOT_INPUT\"");
|
||||||
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
||||||
|
Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0,true,
|
||||||
|
NULL);
|
||||||
|
for (NumCty = 0;
|
||||||
|
NumCty < Gbl.Hierarchy.Ctys.Num;
|
||||||
|
NumCty++)
|
||||||
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
||||||
|
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod,false,
|
||||||
|
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||||
|
HTM_SELECT_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
/* Begin form to select the country of my institution */
|
HTM_TD_End ();
|
||||||
Frm_StartFormAnchor (ActChgCtyMyIns,Rec_MY_INS_CTR_DPT_ID);
|
|
||||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
||||||
"id=\"InsCtyCod\" name=\"OthCtyCod\""
|
|
||||||
" class=\"REC_C2_BOT_INPUT\"");
|
|
||||||
HTM_OPTION (HTM_Type_STRING,"-1",
|
|
||||||
Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0,true,
|
|
||||||
NULL);
|
|
||||||
for (NumCty = 0;
|
|
||||||
NumCty < Gbl.Hierarchy.Ctys.Num;
|
|
||||||
NumCty++)
|
|
||||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
|
||||||
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod,false,
|
|
||||||
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
|
||||||
HTM_SELECT_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Institution *****/
|
/***** Institution *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","OthInsCod",
|
Frm_LabelColumn ("REC_C1_BOT RM","OthInsCod",
|
||||||
Str_BuildStringStr ("%s*",Txt_Institution));
|
Str_BuildStringStr ("%s*",Txt_Institution));
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
|
|
||||||
/* Get list of institutions in this country */
|
/* Get list of institutions in this country */
|
||||||
Ins_FreeListInstitutions ();
|
Ins_FreeListInstitutions ();
|
||||||
if (Gbl.Usrs.Me.UsrDat.InsCtyCod > 0)
|
if (Gbl.Usrs.Me.UsrDat.InsCtyCod > 0)
|
||||||
Ins_GetBasicListOfInstitutions (Gbl.Usrs.Me.UsrDat.InsCtyCod);
|
Ins_GetBasicListOfInstitutions (Gbl.Usrs.Me.UsrDat.InsCtyCod);
|
||||||
|
|
||||||
/* Begin form to select institution */
|
/* Begin form to select institution */
|
||||||
Frm_StartFormAnchor (ActChgMyIns,Rec_MY_INS_CTR_DPT_ID);
|
Frm_StartFormAnchor (ActChgMyIns,Rec_MY_INS_CTR_DPT_ID);
|
||||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||||
"id=\"OthInsCod\" name=\"OthInsCod\""
|
"id=\"OthInsCod\" name=\"OthInsCod\""
|
||||||
" class=\"REC_C2_BOT_INPUT\"");
|
" class=\"REC_C2_BOT_INPUT\"");
|
||||||
HTM_OPTION (HTM_Type_STRING,"-1",
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
||||||
Gbl.Usrs.Me.UsrDat.InsCod < 0,true,
|
Gbl.Usrs.Me.UsrDat.InsCod < 0,true,
|
||||||
NULL);
|
NULL);
|
||||||
HTM_OPTION (HTM_Type_STRING,"0",
|
HTM_OPTION (HTM_Type_STRING,"0",
|
||||||
Gbl.Usrs.Me.UsrDat.InsCod == 0,false,
|
Gbl.Usrs.Me.UsrDat.InsCod == 0,false,
|
||||||
"%s",Txt_Another_institution);
|
"%s",Txt_Another_institution);
|
||||||
for (NumIns = 0;
|
for (NumIns = 0;
|
||||||
NumIns < Gbl.Hierarchy.Inss.Num;
|
NumIns < Gbl.Hierarchy.Inss.Num;
|
||||||
NumIns++)
|
NumIns++)
|
||||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod,
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod,
|
||||||
Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod,false,
|
Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod,false,
|
||||||
"%s",Gbl.Hierarchy.Inss.Lst[NumIns].FullName);
|
"%s",Gbl.Hierarchy.Inss.Lst[NumIns].FullName);
|
||||||
HTM_SELECT_End ();
|
HTM_SELECT_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
if (IAmATeacher)
|
if (IAmATeacher)
|
||||||
{
|
{
|
||||||
/***** Center *****/
|
/***** Center *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","OthCtrCod",
|
Frm_LabelColumn ("REC_C1_BOT RM","OthCtrCod",
|
||||||
Str_BuildStringStr ("%s*",Txt_Center));
|
Str_BuildStringStr ("%s*",Txt_Center));
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
|
|
||||||
/* Get list of centers in this institution */
|
/* Get list of centers in this institution */
|
||||||
Ctr_FreeListCenters ();
|
Ctr_FreeListCenters ();
|
||||||
if (Gbl.Usrs.Me.UsrDat.InsCod > 0)
|
if (Gbl.Usrs.Me.UsrDat.InsCod > 0)
|
||||||
Ctr_GetBasicListOfCenters (Gbl.Usrs.Me.UsrDat.InsCod);
|
Ctr_GetBasicListOfCenters (Gbl.Usrs.Me.UsrDat.InsCod);
|
||||||
|
|
||||||
/* Begin form to select center */
|
/* Begin form to select center */
|
||||||
Frm_StartFormAnchor (ActChgMyCtr,Rec_MY_INS_CTR_DPT_ID);
|
Frm_StartFormAnchor (ActChgMyCtr,Rec_MY_INS_CTR_DPT_ID);
|
||||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||||
"id=\"OthCtrCod\" name=\"OthCtrCod\""
|
"id=\"OthCtrCod\" name=\"OthCtrCod\""
|
||||||
" class=\"REC_C2_BOT_INPUT\"");
|
" class=\"REC_C2_BOT_INPUT\"");
|
||||||
HTM_OPTION (HTM_Type_STRING,"-1",
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0,true,
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0,true,
|
||||||
NULL);
|
NULL);
|
||||||
HTM_OPTION (HTM_Type_STRING,"0",
|
HTM_OPTION (HTM_Type_STRING,"0",
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0,false,
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0,false,
|
||||||
Txt_Another_center);
|
Txt_Another_center);
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod,
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod,
|
||||||
Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod,false,
|
Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod,false,
|
||||||
Gbl.Hierarchy.Ctrs.Lst[NumCtr].FullName);
|
Gbl.Hierarchy.Ctrs.Lst[NumCtr].FullName);
|
||||||
HTM_SELECT_End ();
|
HTM_SELECT_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Department *****/
|
/***** Department *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM",Dpt_PARAM_DPT_COD_NAME,
|
Frm_LabelColumn ("REC_C1_BOT RM",Dpt_PARAM_DPT_COD_NAME,
|
||||||
Str_BuildStringStr ("%s*",Txt_Department));
|
Str_BuildStringStr ("%s*",Txt_Department));
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
Frm_StartFormAnchor (ActChgMyDpt,Rec_MY_INS_CTR_DPT_ID);
|
Frm_StartFormAnchor (ActChgMyDpt,Rec_MY_INS_CTR_DPT_ID);
|
||||||
Dpt_WriteSelectorDepartment (Gbl.Usrs.Me.UsrDat.InsCod, // Departments in my institution
|
Dpt_WriteSelectorDepartment (Gbl.Usrs.Me.UsrDat.InsCod, // Departments in my institution
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.DptCod, // Selected department
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod, // Selected department
|
||||||
"REC_C2_BOT_INPUT", // Selector class
|
"REC_C2_BOT_INPUT", // Selector class
|
||||||
-1L, // First option
|
-1L, // First option
|
||||||
"", // Text when no department selected
|
"", // Text when no department selected
|
||||||
true); // Submit on change
|
true); // Submit on change
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Office *****/
|
/***** Office *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","Office",Txt_Office);
|
Frm_LabelColumn ("REC_C1_BOT RM","Office",Txt_Office);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
Frm_StartFormAnchor (ActChgMyOff,Rec_MY_INS_CTR_DPT_ID);
|
Frm_StartFormAnchor (ActChgMyOff,Rec_MY_INS_CTR_DPT_ID);
|
||||||
HTM_INPUT_TEXT ("Office",Usr_MAX_CHARS_ADDRESS,Gbl.Usrs.Me.UsrDat.Tch.Office,
|
HTM_INPUT_TEXT ("Office",Usr_MAX_CHARS_ADDRESS,Gbl.Usrs.Me.UsrDat.Tch.Office,
|
||||||
HTM_SUBMIT_ON_CHANGE,
|
HTM_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Office\" class=\"REC_C2_BOT_INPUT\"");
|
"id=\"Office\" class=\"REC_C2_BOT_INPUT\"");
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Office phone *****/
|
/***** Office phone *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("REC_C1_BOT RM","OfficePhone",Txt_Phone);
|
Frm_LabelColumn ("REC_C1_BOT RM","OfficePhone",Txt_Phone);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
||||||
Frm_StartFormAnchor (ActChgMyOffPho,Rec_MY_INS_CTR_DPT_ID);
|
Frm_StartFormAnchor (ActChgMyOffPho,Rec_MY_INS_CTR_DPT_ID);
|
||||||
HTM_INPUT_TEL ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
HTM_INPUT_TEL ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
||||||
HTM_SUBMIT_ON_CHANGE,
|
HTM_SUBMIT_ON_CHANGE,
|
||||||
"id=\"OfficePhone\" class=\"REC_C2_BOT_INPUT\"");
|
"id=\"OfficePhone\" class=\"REC_C2_BOT_INPUT\"");
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
|
|
||||||
/***** End section *****/
|
/***** End section *****/
|
||||||
HTM_SECTION_End ();
|
HTM_SECTION_End ();
|
||||||
|
|
||||||
|
// Do not free list of countries here, because it can be reused
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
static void SysCfg_Configuration (bool PrintView);
|
static void SysCfg_Configuration (bool PrintView);
|
||||||
static void SysCfg_PutIconToPrint (__attribute__((unused)) void *Args);
|
static void SysCfg_PutIconToPrint (__attribute__((unused)) void *Args);
|
||||||
static void SysCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom);
|
static void SysCfg_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom);
|
||||||
static void SysCfg_Map (void);
|
static void SysCfg_Map (void);
|
||||||
static void SysCfg_Platform (void);
|
static void SysCfg_Platform (void);
|
||||||
static void SysCfg_Shortcut (bool PrintView);
|
static void SysCfg_Shortcut (bool PrintView);
|
||||||
|
@ -197,7 +197,7 @@ static void SysCfg_PutIconToPrint (__attribute__((unused)) void *Args)
|
||||||
/********* Get average coordinates of centers in current institution *********/
|
/********* Get average coordinates of centers in current institution *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void SysCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
static void SysCfg_GetCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom)
|
||||||
{
|
{
|
||||||
char *Query;
|
char *Query;
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ static void SysCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
||||||
static void SysCfg_Map (void)
|
static void SysCfg_Map (void)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
struct Coordinates CtyAvgCoord;
|
struct Map_Coordinates CtyAvgCoord;
|
||||||
unsigned Zoom;
|
unsigned Zoom;
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
|
|
Loading…
Reference in New Issue