From 917b8469b699800213bda2e93ef32f4cb8559cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 25 Jan 2020 22:18:01 +0100 Subject: [PATCH] Version19.120 --- swad_centre.c | 20 ++++++++++++-- swad_centre.h | 5 ++-- swad_changelog.h | 3 ++- swad_country_config.c | 39 +++++++-------------------- swad_figure.c | 2 +- swad_hierarchy_config.c | 48 ++++++++++++++++++++++++++++++++++ swad_hierarchy_config.h | 2 ++ swad_system_config.c | 58 +++-------------------------------------- 8 files changed, 87 insertions(+), 90 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index acc1090b..9f644a35 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1899,7 +1899,7 @@ static void Ctr_CreateCentre (unsigned Status) /************************** Get number of centres ****************************/ /*****************************************************************************/ -unsigned Ctr_GetNumCtrsTotal (void) +unsigned Ctr_GetNumCtrsInSys (void) { /***** Get total number of centres from database *****/ return (unsigned) DB_GetNumRowsTable ("centres"); @@ -1909,7 +1909,7 @@ unsigned Ctr_GetNumCtrsTotal (void) /********************** Get number of centres with map ***********************/ /*****************************************************************************/ -unsigned Ctr_GetNumCtrsWithMap (void) +unsigned Ctr_GetNumCtrsWithMapInSys (void) { /***** Get number of centres with map from database (coordinates 0, 0 means not set ==> don't show map) *****/ @@ -1949,6 +1949,22 @@ unsigned Ctr_GetNumCtrsInCty (long CtyCod) return Gbl.Cache.NumCtrsInCty.NumCtrs; } +/*****************************************************************************/ +/********************** Get number of centres with map ***********************/ +/*****************************************************************************/ + +unsigned Ctr_GetNumCtrsWithMapInCty (long CtyCod) + { + /***** 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 institutions,centres" + " WHERE institutions.CtyCod=%ld" + " AND institutions.InsCod=centres.InsCod" + " AND (centres.Latitude<>0 OR centres.Longitude<>0)", + CtyCod); + } + /*****************************************************************************/ /**************** Get number of centres in an institution ********************/ /*****************************************************************************/ diff --git a/swad_centre.h b/swad_centre.h index d85a956e..f2588fd4 100644 --- a/swad_centre.h +++ b/swad_centre.h @@ -132,10 +132,11 @@ void Ctr_ContEditAfterChgCtr (void); void Ctr_RecFormReqCtr (void); void Ctr_RecFormNewCtr (void); -unsigned Ctr_GetNumCtrsTotal (void); -unsigned Ctr_GetNumCtrsWithMap (void); +unsigned Ctr_GetNumCtrsInSys (void); +unsigned Ctr_GetNumCtrsWithMapInSys (void); void Ctr_FlushCacheNumCtrsInCty (void); unsigned Ctr_GetNumCtrsInCty (long CtyCod); +unsigned Ctr_GetNumCtrsWithMapInCty (long CtyCod); void Ctr_FlushCacheNumCtrsInIns (void); unsigned Ctr_GetNumCtrsInIns (long InsCod); unsigned Ctr_GetNumCtrsInPlc (long PlcCod); diff --git a/swad_changelog.h b/swad_changelog.h index 72741cdf..edb245b2 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.119 (2020-01-25)" +#define Log_PLATFORM_VERSION "SWAD 19.120 (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.120: Jan 25, 2020 Number of centres with map shown in country configuration. (278592 lines) 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) diff --git a/swad_country_config.c b/swad_country_config.c index d3332a59..4870ff20 100644 --- a/swad_country_config.c +++ b/swad_country_config.c @@ -73,7 +73,6 @@ static void CtyCfg_Shortcut (bool PrintView); static void CtyCfg_QR (void); static void CtyCfg_NumUsrs (void); static void CtyCfg_NumInss (void); -static void CtyCfg_NumCtrs (void); static void CtyCfg_NumDegs (void); static void CtyCfg_NumCrss (void); static void CtyCfg_NumUsrsInCrssOfCty (Rol_Role_t Role); @@ -110,8 +109,9 @@ static void CtyCfg_Configuration (bool PrintView) { extern const char *Hlp_COUNTRY_Information; bool PutLink; - bool MapIsAvailable; bool MapImageExists; + unsigned NumCtrs; + unsigned NumCtrsWithMap; /***** Trivial check *****/ if (Gbl.Hierarchy.Cty.CtyCod <= 0) // No country selected @@ -146,11 +146,14 @@ static void CtyCfg_Configuration (bool PrintView) /***** Shortcut to the country *****/ CtyCfg_Shortcut (PrintView); + NumCtrsWithMap = Ctr_GetNumCtrsWithMapInCty (Gbl.Hierarchy.Cty.CtyCod); if (PrintView) /***** QR code with link to the country *****/ CtyCfg_QR (); else { + NumCtrs = Ctr_GetNumCtrsInCty (Gbl.Hierarchy.Cty.CtyCod); + /***** Number of users who claim to belong to this country, number of institutions, number of centres, @@ -158,7 +161,8 @@ static void CtyCfg_Configuration (bool PrintView) number of courses *****/ CtyCfg_NumUsrs (); CtyCfg_NumInss (); - CtyCfg_NumCtrs (); + HieCfg_NumCtrs (NumCtrs); + HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); CtyCfg_NumDegs (); CtyCfg_NumCrss (); @@ -176,18 +180,15 @@ static void CtyCfg_Configuration (bool PrintView) HTM_DIV_End (); /**************************** Right part **********************************/ - /***** Check map *****/ - MapIsAvailable = Cty_GetIfMapIsAvailable (Gbl.Hierarchy.Cty.CtyCod); - /***** Check country map *****/ MapImageExists = Cty_CheckIfCountryPhotoExists (&Gbl.Hierarchy.Cty); - if (MapIsAvailable || MapImageExists) + if (NumCtrsWithMap || MapImageExists) { HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT HIE_CFG_WIDTH\""); /***** Country map *****/ - if (MapIsAvailable) + if (NumCtrsWithMap) CtyCfg_Map (); /***** Country map image *****/ @@ -516,28 +517,6 @@ static void CtyCfg_NumInss (void) HTM_TR_End (); } -/*****************************************************************************/ -/************* Show number of centres in country configuration ***************/ -/*****************************************************************************/ - -static void CtyCfg_NumCtrs (void) - { - extern const char *Txt_Centres; - - /***** Number of centres *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_Centres); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - HTM_Unsigned (Ctr_GetNumCtrsInCty (Gbl.Hierarchy.Cty.CtyCod)); - HTM_TD_End (); - - HTM_TR_End (); - } - /*****************************************************************************/ /************* Show number of degrees in country configuration ***************/ /*****************************************************************************/ diff --git a/swad_figure.c b/swad_figure.c index caee2c18..3646dae0 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -927,7 +927,7 @@ static void Fig_GetAndShowHierarchyTotal (void) case Hie_SYS: NumCtysTotal = Cty_GetNumCtysTotal (); NumInssTotal = Ins_GetNumInssTotal (); - NumCtrsTotal = Ctr_GetNumCtrsTotal (); + NumCtrsTotal = Ctr_GetNumCtrsInSys (); NumDegsTotal = Deg_GetNumDegsTotal (); NumCrssTotal = Crs_GetNumCrssTotal (); break; diff --git a/swad_hierarchy_config.c b/swad_hierarchy_config.c index aa9adfe2..58802e57 100644 --- a/swad_hierarchy_config.c +++ b/swad_hierarchy_config.c @@ -228,6 +228,54 @@ void HieCfg_Shortcut (bool PrintView,const char *ParamName,long HieCod) HTM_TR_End (); } +/*****************************************************************************/ +/************************** Show number of centres ***************************/ +/*****************************************************************************/ + +void HieCfg_NumCtrs (unsigned NumCtrs) + { + extern const char *Txt_Centres; + + /***** Number of centres *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",NULL,Txt_Centres); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_Unsigned (NumCtrs); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/********************* Show number of centres with map ***********************/ +/*****************************************************************************/ + +void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap) + { + extern const char *Txt_Centres_with_map; + + /***** Number of centres with map *****/ + 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 (); + } + /*****************************************************************************/ /************************* Show QR in configuration **************************/ /*****************************************************************************/ diff --git a/swad_hierarchy_config.h b/swad_hierarchy_config.h index fd557957..3250e55e 100644 --- a/swad_hierarchy_config.h +++ b/swad_hierarchy_config.h @@ -53,6 +53,8 @@ void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction, void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction, const char WWW[Cns_MAX_BYTES_WWW + 1]); void HieCfg_Shortcut (bool PrintView,const char *ParamName,long HieCod); +void HieCfg_NumCtrs (unsigned NumCtrs); +void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap); void HieCfg_QR (const char *ParamName,long HieCod); #endif diff --git a/swad_system_config.c b/swad_system_config.c index 63bbdfd2..8fc54fa5 100644 --- a/swad_system_config.c +++ b/swad_system_config.c @@ -73,8 +73,6 @@ 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 (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); @@ -130,13 +128,13 @@ static void SysCfg_Configuration (bool PrintView) /***** Shortcut to the country *****/ SysCfg_Shortcut (PrintView); - NumCtrsWithMap = Ctr_GetNumCtrsWithMap (); + NumCtrsWithMap = Ctr_GetNumCtrsWithMapInSys (); if (PrintView) /***** QR code with link to the country *****/ SysCfg_QR (); else { - NumCtrs = Ctr_GetNumCtrsTotal (); + NumCtrs = Ctr_GetNumCtrsInSys (); /***** Number of countries, number of institutions, @@ -145,8 +143,8 @@ static void SysCfg_Configuration (bool PrintView) number of courses *****/ SysCfg_NumCtys (); SysCfg_NumInss (); - SysCfg_NumCtrs (NumCtrs); - SysCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); + HieCfg_NumCtrs (NumCtrs); + HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); SysCfg_NumDegs (); SysCfg_NumCrss (); @@ -375,54 +373,6 @@ static void SysCfg_NumInss (void) HTM_TR_End (); } -/*****************************************************************************/ -/************** Show number of centres in system configuration ***************/ -/*****************************************************************************/ - -static void SysCfg_NumCtrs (unsigned NumCtrs) - { - extern const char *Txt_Centres; - - /***** Number of centres *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_Centres); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - 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 (); - } - /*****************************************************************************/ /************* Show number of degrees in system configuration ****************/ /*****************************************************************************/