From 5aa20a07496fbfb45248d89c1cb6c20e16af62fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 25 Jan 2020 21:34:20 +0100 Subject: [PATCH] Version19.119 --- swad_centre.c | 13 ++++++++ swad_centre.h | 1 + swad_changelog.h | 3 +- swad_figure.c | 4 +-- swad_system_config.c | 76 ++++++++++++++++++++++---------------------- swad_text.c | 21 ++++++++++++ 6 files changed, 77 insertions(+), 41 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index a220a1a01..acc1090b5 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1905,6 +1905,19 @@ unsigned Ctr_GetNumCtrsTotal (void) return (unsigned) DB_GetNumRowsTable ("centres"); } +/*****************************************************************************/ +/********************** Get number of centres with map ***********************/ +/*****************************************************************************/ + +unsigned Ctr_GetNumCtrsWithMap (void) + { + /***** Get number of centres with map from database + (coordinates 0, 0 means not set ==> don't show map) *****/ + return (unsigned) DB_QueryCOUNT ("can not get if map is available", + "SELECT COUNT(*) FROM centres" + " WHERE Latitude<>0 OR Longitude<>0"); + } + /*****************************************************************************/ /******************* Get number of centres in a country **********************/ /*****************************************************************************/ diff --git a/swad_centre.h b/swad_centre.h index 3f12eeb79..d85a956e4 100644 --- a/swad_centre.h +++ b/swad_centre.h @@ -133,6 +133,7 @@ void Ctr_RecFormReqCtr (void); void Ctr_RecFormNewCtr (void); unsigned Ctr_GetNumCtrsTotal (void); +unsigned Ctr_GetNumCtrsWithMap (void); void Ctr_FlushCacheNumCtrsInCty (void); unsigned Ctr_GetNumCtrsInCty (long CtyCod); void Ctr_FlushCacheNumCtrsInIns (void); diff --git a/swad_changelog.h b/swad_changelog.h index d90e2c691..72741cdfb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -494,7 +494,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.118.2 (2020-01-23)" +#define Log_PLATFORM_VERSION "SWAD 19.119 (2020-01-25)" #define CSS_FILE "swad19.118.css" #define JS_FILE "swad19.91.1.js" /* @@ -502,6 +502,7 @@ ps2pdf source.ps destination.pdf // 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é? + Version 19.119: Jan 25, 2020 Number of centres with map shown in platform configuration. (278591 lines) Version 19.118.2: Jan 23, 2020 Fixed bug in enrolment notifications. (278559 lines) Version 19.118.1: Jan 23, 2020 Fixed bug in marks, reported by Diana Alexandra Dumitru. (278554 lines) Version 19.118: Jan 14, 2020 Responsive maps. (278546 lines) diff --git a/swad_figure.c b/swad_figure.c index c91aa8be6..caee2c185 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -3434,7 +3434,7 @@ static void Fig_GetAndShowTimelineActivityStats (void) HTM_TD_Begin ("class=\"DAT RM\""); HTM_Double2Decimals (NumUsrs ? (double) NumNotes / (double) NumUsrs : - 0.0); + 0.0); HTM_TD_End (); HTM_TR_End (); @@ -3554,7 +3554,7 @@ static void Fig_GetAndShowTimelineActivityStats (void) HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); HTM_Double2Decimals (NumUsrs ? (double) NumNotes / (double) NumUsrs : - 0.0); + 0.0); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_system_config.c b/swad_system_config.c index 79395855a..63bbdfd28 100644 --- a/swad_system_config.c +++ b/swad_system_config.c @@ -66,7 +66,6 @@ static void SysCfg_Configuration (bool PrintView); static void SysCfg_PutIconToPrint (void); -static bool SysCfg_GetIfMapIsAvailable (void); static void SysCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom); static void SysCfg_Map (void); static void SysCfg_Platform (void); @@ -74,7 +73,8 @@ static void SysCfg_Shortcut (bool PrintView); static void SysCfg_QR (void); static void SysCfg_NumCtys (void); static void SysCfg_NumInss (void); -static void SysCfg_NumCtrs (void); +static void SysCfg_NumCtrs (unsigned NumCtrs); +static void SysCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap); static void SysCfg_NumDegs (void); static void SysCfg_NumCrss (void); static void SysCfg_NumUsrsInCrss (Rol_Role_t Role); @@ -107,7 +107,8 @@ void SysCfg_PrintConfiguration (void) static void SysCfg_Configuration (bool PrintView) { extern const char *Hlp_SYSTEM_Information; - bool MapIsAvailable; + unsigned NumCtrs; + unsigned NumCtrsWithMap; /***** Begin box *****/ if (PrintView) @@ -129,11 +130,14 @@ static void SysCfg_Configuration (bool PrintView) /***** Shortcut to the country *****/ SysCfg_Shortcut (PrintView); + NumCtrsWithMap = Ctr_GetNumCtrsWithMap (); if (PrintView) /***** QR code with link to the country *****/ SysCfg_QR (); else { + NumCtrs = Ctr_GetNumCtrsTotal (); + /***** Number of countries, number of institutions, number of centres, @@ -141,7 +145,8 @@ static void SysCfg_Configuration (bool PrintView) number of courses *****/ SysCfg_NumCtys (); SysCfg_NumInss (); - SysCfg_NumCtrs (); + SysCfg_NumCtrs (NumCtrs); + SysCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); SysCfg_NumDegs (); SysCfg_NumCrss (); @@ -159,10 +164,7 @@ static void SysCfg_Configuration (bool PrintView) HTM_DIV_End (); /**************************** Right part **********************************/ - /***** Check map *****/ - MapIsAvailable = SysCfg_GetIfMapIsAvailable (); - - if (MapIsAvailable) + if (NumCtrsWithMap) { HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT HIE_CFG_WIDTH\""); @@ -185,34 +187,6 @@ static void SysCfg_PutIconToPrint (void) Ico_PutContextualIconToPrint (ActPrnSysInf,NULL); } -/*****************************************************************************/ -/******************* Check if any of the centres has map *********************/ -/*****************************************************************************/ - -static bool SysCfg_GetIfMapIsAvailable (void) - { - MYSQL_RES *mysql_res; - MYSQL_ROW row; - bool MapIsAvailable = false; - - /***** Get if any centre has a coordinate set - (coordinates 0, 0 means not set ==> don't show map) *****/ - if (DB_QuerySELECT (&mysql_res,"can not get if map is available", - "SELECT EXISTS" - "(SELECT * FROM centres" - " WHERE centres.Latitude<>0 OR centres.Longitude<>0)")) - { - /* Get if map is available */ - row = mysql_fetch_row (mysql_res); - MapIsAvailable = (row[0][0] == '1'); - } - - /* Free structure that stores the query result */ - DB_FreeMySQLResult (&mysql_res); - - return MapIsAvailable; - } - /*****************************************************************************/ /********* Get average coordinates of centres in current institution *********/ /*****************************************************************************/ @@ -405,7 +379,7 @@ static void SysCfg_NumInss (void) /************** Show number of centres in system configuration ***************/ /*****************************************************************************/ -static void SysCfg_NumCtrs (void) +static void SysCfg_NumCtrs (unsigned NumCtrs) { extern const char *Txt_Centres; @@ -417,7 +391,33 @@ static void SysCfg_NumCtrs (void) /* Data */ HTM_TD_Begin ("class=\"DAT LB\""); - HTM_Unsigned (Ctr_GetNumCtrsTotal ()); + HTM_Unsigned (NumCtrs); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/********** Show number of centres with map in system configuration **********/ +/*****************************************************************************/ + +static void SysCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap) + { + extern const char *Txt_Centres_with_map; + + /***** Number of centres *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",NULL,Txt_Centres_with_map); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_TxtF ("%u (%.1lf%%)", + NumCtrsWithMap, + NumCtrs ? (double) NumCtrsWithMap * 100.0 / + (double) NumCtrs : + 0.0); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_text.c b/swad_text.c index bb1e14954..a3f58da57 100644 --- a/swad_text.c +++ b/swad_text.c @@ -3527,6 +3527,27 @@ const char *Txt_CENTRES_ORDER[Ctr_NUM_ORDERS] = #endif }; +const char *Txt_Centres_with_map = +#if L==1 // ca + "Centres amb mapa"; +#elif L==2 // de + "Lehrinstitute mit Karte"; +#elif L==3 // en + "Centres with map"; +#elif L==4 // es + "Centros con mapa"; +#elif L==5 // fr + "Centres avec carte"; +#elif L==6 // gn + "Centros con mapa"; // Okoteve traducción +#elif L==7 // it + "Centri con mappa"; +#elif L==8 // pl + "Centra z mapą"; +#elif L==9 // pt + "Centros com mapa"; +#endif + const char *Txt_Centres_with_pending_degrees = #if L==1 // ca "Centres amb titulacions pendents d'activar";