diff --git a/swad_centre.c b/swad_centre.c index 9f644a35..3bd43899 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1905,19 +1905,6 @@ unsigned Ctr_GetNumCtrsInSys (void) return (unsigned) DB_GetNumRowsTable ("centres"); } -/*****************************************************************************/ -/********************** Get number of centres with map ***********************/ -/*****************************************************************************/ - -unsigned Ctr_GetNumCtrsWithMapInSys (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 **********************/ /*****************************************************************************/ @@ -1949,22 +1936,6 @@ 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 ********************/ /*****************************************************************************/ @@ -1996,6 +1967,50 @@ unsigned Ctr_GetNumCtrsInIns (long InsCod) return Gbl.Cache.NumCtrsInIns.NumCtrs; } +/*****************************************************************************/ +/********************** Get number of centres with map ***********************/ +/*****************************************************************************/ + +unsigned Ctr_GetNumCtrsWithMapInSys (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 number of centres with map", + "SELECT COUNT(*) FROM centres" + " WHERE Latitude<>0 OR Longitude<>0"); + } + +/*****************************************************************************/ +/************** Get number of centres with map in a country ******************/ +/*****************************************************************************/ + +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 ("ccan not get number of centres with map", + "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 with map in an institution **************/ +/*****************************************************************************/ + +unsigned Ctr_GetNumCtrsWithMapInIns (long InsCod) + { + /***** 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 number of centres with map", + "SELECT COUNT(*) FROM centres" + " WHERE InsCod=%ld" + " AND (Latitude<>0 OR Longitude<>0)", + InsCod); + } + /*****************************************************************************/ /******* Get number of centres (of the current institution) in a place *******/ /*****************************************************************************/ diff --git a/swad_centre.h b/swad_centre.h index f2588fd4..9166e000 100644 --- a/swad_centre.h +++ b/swad_centre.h @@ -133,12 +133,13 @@ void Ctr_RecFormReqCtr (void); void Ctr_RecFormNewCtr (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_GetNumCtrsWithMapInSys (void); +unsigned Ctr_GetNumCtrsWithMapInCty (long CtyCod); +unsigned Ctr_GetNumCtrsWithMapInIns (long InsCod); unsigned Ctr_GetNumCtrsInPlc (long PlcCod); unsigned Ctr_GetNumCtrsWithDegs (const char *SubQuery); unsigned Ctr_GetNumCtrsWithCrss (const char *SubQuery); diff --git a/swad_changelog.h b/swad_changelog.h index edb245b2..ed5d79a1 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.120 (2020-01-25)" +#define Log_PLATFORM_VERSION "SWAD 19.121 (2020-01-26)" #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.121: Jan 26, 2020 Number of centres with map shown in institution configuration. (278601 lines) 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) diff --git a/swad_country_config.c b/swad_country_config.c index 4870ff20..6ecc5f7e 100644 --- a/swad_country_config.c +++ b/swad_country_config.c @@ -161,7 +161,8 @@ static void CtyCfg_Configuration (bool PrintView) number of courses *****/ CtyCfg_NumUsrs (); CtyCfg_NumInss (); - HieCfg_NumCtrs (NumCtrs); + HieCfg_NumCtrs (NumCtrs, + false); // Don't put form HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); CtyCfg_NumDegs (); CtyCfg_NumCrss (); diff --git a/swad_hierarchy_config.c b/swad_hierarchy_config.c index 58802e57..4f7feed8 100644 --- a/swad_hierarchy_config.c +++ b/swad_hierarchy_config.c @@ -232,9 +232,10 @@ void HieCfg_Shortcut (bool PrintView,const char *ParamName,long HieCod) /************************** Show number of centres ***************************/ /*****************************************************************************/ -void HieCfg_NumCtrs (unsigned NumCtrs) +void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm) { extern const char *Txt_Centres; + extern const char *Txt_Centres_of_INSTITUTION_X; /***** Number of centres *****/ HTM_TR_Begin (NULL); @@ -243,8 +244,22 @@ void HieCfg_NumCtrs (unsigned NumCtrs) Frm_LabelColumn ("RT",NULL,Txt_Centres); /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); + HTM_TD_Begin ("class=\"LB\""); + if (PutForm) + { + Frm_StartFormGoTo (ActSeeCtr); + Ins_PutParamInsCod (Gbl.Hierarchy.Ins.InsCod); + HTM_BUTTON_SUBMIT_Begin (Str_BuildStringStr (Txt_Centres_of_INSTITUTION_X, + Gbl.Hierarchy.Ins.ShrtName), + "BT_LINK DAT",NULL); + Str_FreeString (); + } HTM_Unsigned (NumCtrs); + if (PutForm) + { + HTM_BUTTON_End (); + Frm_EndForm (); + } HTM_TD_End (); HTM_TR_End (); diff --git a/swad_hierarchy_config.h b/swad_hierarchy_config.h index 3250e55e..3144ded7 100644 --- a/swad_hierarchy_config.h +++ b/swad_hierarchy_config.h @@ -53,7 +53,7 @@ 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_NumCtrs (unsigned NumCtrs,bool PutForm); void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap); void HieCfg_QR (const char *ParamName,long HieCod); diff --git a/swad_institution_config.c b/swad_institution_config.c index fa93c54a..07a90d03 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -74,7 +74,6 @@ static void InsCfg_WWW (bool PrintView,bool PutForm); static void InsCfg_Shortcut (bool PrintView); static void InsCfg_QR (void); static void InsCfg_NumUsrs (void); -static void InsCfg_NumCtrs (void); static void InsCfg_NumDegs (void); static void InsCfg_NumCrss (void); static void InsCfg_NumDpts (void); @@ -113,7 +112,8 @@ static void InsCfg_Configuration (bool PrintView) bool PutFormCty; bool PutFormName; bool PutFormWWW; - bool MapIsAvailable; + unsigned NumCtrs; + unsigned NumCtrsWithMap; /***** Trivial check *****/ if (Gbl.Hierarchy.Ins.InsCod <= 0) // No institution selected @@ -156,18 +156,23 @@ static void InsCfg_Configuration (bool PrintView) /***** Shortcut to the institution *****/ InsCfg_Shortcut (PrintView); + NumCtrsWithMap = Ctr_GetNumCtrsWithMapInIns (Gbl.Hierarchy.Ins.InsCod); if (PrintView) /***** QR code with link to the institution *****/ InsCfg_QR (); else { + NumCtrs = Ctr_GetNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod); + /***** Number of users who claim to belong to this institution, number of centres, number of degrees, number of courses, number of departments *****/ InsCfg_NumUsrs (); - InsCfg_NumCtrs (); + HieCfg_NumCtrs (NumCtrs, + true); // Put form + HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); InsCfg_NumDegs (); InsCfg_NumCrss (); InsCfg_NumDpts (); @@ -186,10 +191,7 @@ static void InsCfg_Configuration (bool PrintView) HTM_DIV_End (); /**************************** Right part **********************************/ - /***** Check map *****/ - MapIsAvailable = Ins_GetIfMapIsAvailable (Gbl.Hierarchy.Ins.InsCod); - - if (MapIsAvailable) + if (NumCtrsWithMap) { HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT HIE_CFG_WIDTH\""); @@ -470,37 +472,6 @@ static void InsCfg_NumUsrs (void) HTM_TR_End (); } -/*****************************************************************************/ -/*********** Show number of centres in institution configuration *************/ -/*****************************************************************************/ - -static void InsCfg_NumCtrs (void) - { - extern const char *Txt_Centres; - extern const char *Txt_Centres_of_INSTITUTION_X; - - /***** Number of centres *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_Centres); - - /* Data */ - HTM_TD_Begin ("class=\"LB\""); - Frm_StartFormGoTo (ActSeeCtr); - Ins_PutParamInsCod (Gbl.Hierarchy.Ins.InsCod); - HTM_BUTTON_SUBMIT_Begin (Str_BuildStringStr (Txt_Centres_of_INSTITUTION_X, - Gbl.Hierarchy.Ins.ShrtName), - "BT_LINK DAT",NULL); - Str_FreeString (); - HTM_Unsigned (Ctr_GetNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod)); - HTM_BUTTON_End (); - Frm_EndForm (); - HTM_TD_End (); - - HTM_TR_End (); - } - /*****************************************************************************/ /*********** Show number of degrees in institution configuration *************/ /*****************************************************************************/ diff --git a/swad_system_config.c b/swad_system_config.c index 8fc54fa5..ed3cdca1 100644 --- a/swad_system_config.c +++ b/swad_system_config.c @@ -143,7 +143,8 @@ static void SysCfg_Configuration (bool PrintView) number of courses *****/ SysCfg_NumCtys (); SysCfg_NumInss (); - HieCfg_NumCtrs (NumCtrs); + HieCfg_NumCtrs (NumCtrs, + false); // Don't put form HieCfg_NumCtrsWithMap (NumCtrs,NumCtrsWithMap); SysCfg_NumDegs (); SysCfg_NumCrss ();