From 7cb4c962fc5941f39a47a103ad1205b2bccf83ce Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 6 Apr 2020 23:18:02 +0200 Subject: [PATCH] Version19.167 --- swad_API.c | 2 +- swad_assignment.c | 3 +- swad_calendar.c | 5 +-- swad_centre.c | 6 +-- swad_changelog.h | 28 ++++++++++++- swad_cookie.c | 5 +-- swad_country.c | 6 +-- swad_course.c | 6 +-- swad_date.c | 5 +-- swad_degree.c | 6 +-- swad_degree_type.c | 33 ++++++++++----- swad_figure.c | 98 +++++++++++++++++++++++---------------------- swad_figure.h | 12 +++++- swad_file_browser.c | 5 +-- swad_follow.c | 3 +- swad_forum.c | 5 +-- swad_game.c | 3 +- swad_global.c | 1 - swad_global.h | 4 -- swad_icon.c | 5 +-- swad_institution.c | 6 +-- swad_language.c | 5 +-- swad_menu.c | 5 +-- swad_message.c | 3 +- swad_network.c | 5 +-- swad_notice.c | 3 +- swad_notification.c | 5 +-- swad_privacy.c | 5 +-- swad_program.c | 3 +- swad_project.c | 3 +- swad_setting.c | 5 +-- swad_survey.c | 3 +- swad_test.c | 3 +- swad_theme.c | 5 +-- swad_timeline.c | 5 +-- swad_user.c | 9 ++--- 36 files changed, 146 insertions(+), 168 deletions(-) diff --git a/swad_API.c b/swad_API.c index 51ab97dc..69bee5ca 100644 --- a/swad_API.c +++ b/swad_API.c @@ -911,7 +911,7 @@ int swad__loginByUserPasswordKey (struct soap *soap, " AND usr_data.Password='%s'", UsrIDNickOrEmail,userPassword); } - else if (Mai_CheckIfEmailIsValid (Gbl.Usrs.Me.UsrIdLogin)) // 2: It's an email + else if (Mai_CheckIfEmailIsValid (UsrIDNickOrEmail)) // 2: It's an email { /* User has typed an email */ // TODO: Get only if email confirmed? diff --git a/swad_assignment.c b/swad_assignment.c index 7fac541b..a3cc5797 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -298,8 +298,7 @@ static void Asg_PutIconsListAssignments (void *Assignments) Asg_PutIconToCreateNewAsg (Assignments); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_ASSIGNMENTS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_ASSIGNMENTS); } /*****************************************************************************/ diff --git a/swad_calendar.c b/swad_calendar.c index 36140486..96d23060 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -98,11 +98,8 @@ void Cal_PutIconsToSelectFirstDayOfWeek (void) static void Cal_PutIconsFirstDayOfWeek (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_FIRST_DAY_OF_WEEK; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_FIRST_DAY_OF_WEEK); } /*****************************************************************************/ diff --git a/swad_centre.c b/swad_centre.c index 167a09df..d5cdc079 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -333,8 +333,7 @@ static void Ctr_PutIconsListingCentres (void *Args) Plc_PutIconToViewPlaces (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } @@ -515,8 +514,7 @@ static void Ctr_PutIconsEditingCentres (void *Args) Plc_PutIconToViewPlaces (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } diff --git a/swad_changelog.h b/swad_changelog.h index 456a6c87..b5325e30 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,14 +497,25 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.166 (2020-04-06)" +#define Log_PLATFORM_VERSION "SWAD 19.167 (2020-04-06)" #define CSS_FILE "swad19.146.css" #define JS_FILE "swad19.153.js" /* * + Call parameters: + userID: string (DNI/passport, @nickname or email of the user). // TODO: Geolocalización: + + Función API sendCurrentLocation... -Parámetros: string con ubicación (ej. "Aula 0.1") +Parámetros a enviar a la función: + 1. Código único de ubicación (número) +Almacenaría esa ubicación en una tabla +- Código usuario +- Código de ubicación (sacado de la tabla de ubicaciones) +- Fecha-hora + +Haría falta una función API que envíe el histórico reciente de ubicaciones de un usuario Poblar base de datos: En Usuarios > Ubicación aparecería un botón pequeño de "Añadir ubicación". @@ -516,6 +527,15 @@ Si es as Función API newLocation... Paramétros: MAC, string con ubicación (ej. "Aula 0.1") + +Función API getLocations +1. Añadir tipo de ubicación +2. Añadir lista desplegable de MAC asociadas a una ubicación +3. API: getLocations (como parámetro se pasa la MAC) + - que devolveria las filas de la tabla de ubicaciones asociadas a esa MAC + + + // TODO: Laura García: "Ahora estoy utilizando la plataforma SWAD más que nunca, evidentemente, debido a las circunstancias, e incluso les he hecho un examencillo a los alumnos utilizando los test de autoevaluación. Pero quería preguntarte un par de cosas: - lo primero es si se pueden borrar los test realizados por cualquier usuario, incluido profesores. Yo misma he hecho un montón para simular el examen, y ya me están sobrando. @@ -528,6 +548,10 @@ Param // TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores // TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub +// TODO: Bug en SWADroid: loginByUserPasswordKey falla cuando se le pasa como parámetro un DNI + + Version 19.167: Apr 06, 2020 Code refactoring in figures. (284772 lines) + Version 19.166.1: Apr 06, 2020 Fixed bug in API function loginByUserPasswordKey, reported by Javier Bueno López. (? lines) Version 19.166: Apr 06, 2020 Code refactoring in banners. (284805 lines) Version 19.165: Apr 06, 2020 Code refactoring in attendance events. (284743 lines) Version 19.164: Apr 05, 2020 Code refactoring in assignments and pagination. (284644 lines) diff --git a/swad_cookie.c b/swad_cookie.c index e151de9a..1832375c 100644 --- a/swad_cookie.c +++ b/swad_cookie.c @@ -105,11 +105,8 @@ void Coo_EditMyPrefsOnCookies (void) static void Coo_PutIconsCookies (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_COOKIES; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_COOKIES); } /*****************************************************************************/ diff --git a/swad_country.c b/swad_country.c index 10fd7f2e..f6f573df 100644 --- a/swad_country.c +++ b/swad_country.c @@ -467,8 +467,7 @@ static void Cty_PutIconsListingCountries (void *Args) Cty_PutIconToEditCountries (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } @@ -711,8 +710,7 @@ static void Cty_PutIconsEditingCountries (void *Args) Cty_PutIconToViewCountries (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } diff --git a/swad_course.c b/swad_course.c index 08e97512..49df21ac 100644 --- a/swad_course.c +++ b/swad_course.c @@ -862,8 +862,7 @@ static void Crs_PutIconsListCourses (void *Args) Crs_PutIconToEditCourses (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } @@ -1053,8 +1052,7 @@ static void Crs_PutIconsEditingCourses (void *Args) Crs_PutIconToViewCourses (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } diff --git a/swad_date.c b/swad_date.c index 9035bfe2..a73770b9 100644 --- a/swad_date.c +++ b/swad_date.c @@ -150,11 +150,8 @@ void Dat_PutBoxToSelectDateFormat (void) static void Dat_PutIconsDateFormat (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_DATE_FORMAT; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_DATE_FORMAT); } /*****************************************************************************/ diff --git a/swad_degree.c b/swad_degree.c index c2a253ca..ef3fe69f 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -827,8 +827,7 @@ static void Deg_PutIconsListingDegrees (void *Args) DT_PutIconToViewDegreeTypes (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } @@ -1002,8 +1001,7 @@ static void Deg_PutIconsEditingDegrees (void *Args) DT_PutIconToViewDegreeTypes (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_HIERARCHY; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_HIERARCHY); } } diff --git a/swad_degree_type.c b/swad_degree_type.c index 20a709d5..5c448c96 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -70,7 +70,9 @@ static void DT_SeeDegreeTypes (Act_Action_t NextAction,Hie_Level_t Scope, DT_Order_t DefaultOrder); static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder); -static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder); +static void DT_ListDegreeTypes (Act_Action_t NextAction, + Hie_Level_t Scope, + DT_Order_t SelectedOrder); static void DT_EditDegreeTypesInternal (void); static void DT_PutIconsEditingDegreeTypes (void *Args); @@ -82,7 +84,9 @@ static void DT_ListDegreeTypesForEdition (void); static void DT_PutFormToCreateDegreeType (void); -static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,DT_Order_t SelectedOrder); +static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction, + Hie_Level_t Scope, + DT_Order_t SelectedOrder); static void DT_PutHeadDegreeTypesForEdition (void); static void DT_CreateDegreeType (struct DegreeType *DegTyp); @@ -154,7 +158,7 @@ static void DT_SeeDegreeTypes (Act_Action_t NextAction,Hie_Level_t Scope, DT_GetListDegreeTypes (Scope,SelectedOrder); /***** List degree types *****/ - DT_ListDegreeTypes (NextAction,SelectedOrder); + DT_ListDegreeTypes (NextAction,Scope,SelectedOrder); /***** Free list of degree types *****/ DT_FreeListDegreeTypes (); @@ -179,7 +183,9 @@ static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder) // - centre tab => NextAction = ActSeeDegTyp // - statistic tab => NextAction = ActSeeUseGbl -static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder) +static void DT_ListDegreeTypes (Act_Action_t NextAction, + Hie_Level_t Scope, + DT_Order_t SelectedOrder) { extern const char *Hlp_CENTRE_DegreeTypes; extern const char *Hlp_ANALYTICS_Figures_types_of_degree; @@ -209,7 +215,7 @@ static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder { /***** Write heading *****/ HTM_TABLE_BeginWideMarginPadding (2); - DT_PutHeadDegreeTypesForSeeing (NextAction,SelectedOrder); + DT_PutHeadDegreeTypesForSeeing (NextAction,Scope,SelectedOrder); /***** List current degree types for seeing *****/ DT_ListDegreeTypesForSeeing (); @@ -291,8 +297,7 @@ static void DT_PutIconsEditingDegreeTypes (void *Args) Deg_PutIconToViewDegrees (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_DEGREE_TYPES; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_DEGREE_TYPES); } } @@ -366,8 +371,7 @@ static void DT_PutIconsListingDegTypes (void *Args) Deg_PutIconToViewDegrees (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_DEGREE_TYPES; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_DEGREE_TYPES); } } @@ -506,11 +510,14 @@ static void DT_PutFormToCreateDegreeType (void) /***************** Write header with fields of a degree type *****************/ /*****************************************************************************/ -static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,DT_Order_t SelectedOrder) +static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction, + Hie_Level_t Scope, + DT_Order_t SelectedOrder) { extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS]; extern const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS]; DT_Order_t Order; + struct Fig_Figures Figures; HTM_TR_Begin (NULL); HTM_TH_Empty (1); @@ -524,7 +531,11 @@ static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,DT_Order_t S /* Begin form to change order */ Frm_StartForm (NextAction); if (NextAction == ActSeeUseGbl) - Fig_PutHiddenParamFigures (&Gbl); + { + Figures.Scope = Scope; + Figures.FigureType = Fig_DEGREE_TYPES; + Fig_PutHiddenParamFigures (&Figures); + } Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order); /* Link with the head of this column */ diff --git a/swad_figure.c b/swad_figure.c index c81a589d..109f5f8e 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -83,13 +83,18 @@ struct Fig_FiguresForum unsigned NumUsrsToBeNotifiedByEMail; }; +/*****************************************************************************/ +/***************************** Private variables *****************************/ +/*****************************************************************************/ + /*****************************************************************************/ /****************************** Private prototypes ***************************/ /*****************************************************************************/ -static void Fig_PutParamsToShowFigure (void *Args); -static void Fig_PutHiddenParamFigureType (void); -static void Fig_PutHiddenParamScopeFig (void); +static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType); + +static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType); +static void Fig_PutHiddenParamScopeFig (Hie_Level_t ScopeFig); static void Fig_GetAndShowHierarchyStats (void); static void Fig_WriteHeadHierarchy (void); @@ -190,6 +195,11 @@ unsigned Fig_GetNumUsrsWhoChoseAnOption (const char *SubQuery); /*****************************************************************************/ void Fig_ReqShowFigures (void) + { + Fig_ReqShowFigure (Fig_FIGURE_TYPE_DEF); + } + +static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType) { extern const char *Hlp_ANALYTICS_Figures; extern const char *The_ClassFormInBox[The_NUM_THEMES]; @@ -198,7 +208,7 @@ void Fig_ReqShowFigures (void) extern const char *Txt_Statistic; extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES]; extern const char *Txt_Show_statistic; - Fig_FigureType_t FigureType; + Fig_FigureType_t FigType; unsigned FigureTypeUnsigned; /***** Form to show statistic *****/ @@ -229,14 +239,14 @@ void Fig_ReqShowFigures (void) HTM_TxtColonNBSP (Txt_Statistic); HTM_SELECT_Begin (false, "name=\"FigureType\""); - for (FigureType = (Fig_FigureType_t) 0; - FigureType <= (Fig_FigureType_t) (Fig_NUM_FIGURES - 1); - FigureType++) + for (FigType = (Fig_FigureType_t) 0; + FigType <= (Fig_FigureType_t) (Fig_NUM_FIGURES - 1); + FigType++) { - FigureTypeUnsigned = (unsigned) FigureType; + FigureTypeUnsigned = (unsigned) FigType; HTM_OPTION (HTM_Type_UNSIGNED,&FigureTypeUnsigned, - FigureType == Gbl.Figures.FigureType,false, - "%s",Txt_FIGURE_TYPES[FigureType]); + FigType == SelectedFigureType,false, + "%s",Txt_FIGURE_TYPES[FigType]); } HTM_SELECT_End (); HTM_LABEL_End (); @@ -251,14 +261,21 @@ void Fig_ReqShowFigures (void) /*****************************************************************************/ /************************* Put icon to show a figure *************************/ /*****************************************************************************/ -// Gbl.Figures.FigureType must be set to the desired figure before calling this function -void Fig_PutIconToShowFigure (void) +void Fig_PutIconToShowFigure (Fig_FigureType_t FigureType) { extern const char *Txt_Show_statistic; + struct Fig_Figures Figures; + /***** Set default scope (used only if Gbl.Scope.Current is unknown) *****/ + Gbl.Scope.Default = Hie_CRS; + Sco_AdjustScope (); + + /***** Put icon to show figure *****/ + Figures.Scope = Gbl.Scope.Current; + Figures.FigureType = FigureType; Lay_PutContextualLinkOnlyIcon (ActSeeUseGbl,NULL, - Fig_PutParamsToShowFigure,&Gbl, + Fig_PutHiddenParamFigures,&Figures, "chart-pie.svg", Txt_Show_statistic); } @@ -266,30 +283,13 @@ void Fig_PutIconToShowFigure (void) /*****************************************************************************/ /************* Put hidden parameters for figures (statistics) ****************/ /*****************************************************************************/ -// Gbl.Figures.FigureType must be set to the desired figure before calling this function -static void Fig_PutParamsToShowFigure (void *Args) +void Fig_PutHiddenParamFigures (void *Figures) { - if (Args) + if (Figures) { - /***** Set default scope (used only if Gbl.Scope.Current is unknown) *****/ - Gbl.Scope.Default = Hie_CRS; - Sco_AdjustScope (); - - Fig_PutHiddenParamFigures (&Gbl); - } - } - -/*****************************************************************************/ -/************* Put hidden parameters for figures (statistics) ****************/ -/*****************************************************************************/ - -void Fig_PutHiddenParamFigures (void *Args) - { - if (Args) - { - Fig_PutHiddenParamScopeFig (); - Fig_PutHiddenParamFigureType (); + Fig_PutHiddenParamScopeFig (((struct Fig_Figures *) Figures)->Scope); + Fig_PutHiddenParamFigureType (((struct Fig_Figures *) Figures)->FigureType); } } @@ -297,18 +297,18 @@ void Fig_PutHiddenParamFigures (void *Args) /********* Put hidden parameter for the type of figure (statistic) ***********/ /*****************************************************************************/ -static void Fig_PutHiddenParamFigureType (void) +static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType) { - Par_PutHiddenParamUnsigned (NULL,"FigureType",(unsigned) Gbl.Figures.FigureType); + Par_PutHiddenParamUnsigned (NULL,"FigureType",(unsigned) FigureType); } /*****************************************************************************/ /********* Put hidden parameter for the type of figure (statistic) ***********/ /*****************************************************************************/ -static void Fig_PutHiddenParamScopeFig (void) +static void Fig_PutHiddenParamScopeFig (Hie_Level_t ScopeFig) { - Sco_PutParamScope ("ScopeFig",Gbl.Scope.Current); + Sco_PutParamScope ("ScopeFig",ScopeFig); } /*****************************************************************************/ @@ -326,7 +326,7 @@ void Fig_ShowFigures (void) [Fig_DEGREE_TYPES ] = Fig_GetAndShowDegreeTypesStats, [Fig_FOLDERS_AND_FILES] = Fig_GetAndShowFileBrowsersStats, [Fig_OER ] = Fig_GetAndShowOERsStats, - [Fig_COURSE_PROGRAMS ] = Fig_GetAndShowCourseProgramStats, + [Fig_COURSE_PROGRAMS ] = Fig_GetAndShowCourseProgramStats, [Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats, [Fig_PROJECTS ] = Fig_GetAndShowProjectsStats, [Fig_TESTS ] = Fig_GetAndShowTestsStats, @@ -349,19 +349,20 @@ void Fig_ShowFigures (void) [Fig_PRIVACY ] = Fig_GetAndShowNumUsrsPerPrivacy, [Fig_COOKIES ] = Fig_GetAndShowNumUsrsPerCookies, }; + Fig_FigureType_t SelectedFigureType; /***** Get the type of figure ******/ - Gbl.Figures.FigureType = (Fig_FigureType_t) - Par_GetParToUnsignedLong ("FigureType", - 0, - Fig_NUM_FIGURES - 1, - (unsigned long) Fig_FIGURE_TYPE_DEF); + SelectedFigureType = (Fig_FigureType_t) + Par_GetParToUnsignedLong ("FigureType", + 0, + Fig_NUM_FIGURES - 1, + (unsigned long) Fig_FIGURE_TYPE_DEF); /***** Show again the form to see use of the platform *****/ - Fig_ReqShowFigures (); + Fig_ReqShowFigure (SelectedFigureType); /***** Show the stat of use selected by user *****/ - Fig_Function[Gbl.Figures.FigureType] (); + Fig_Function[SelectedFigureType] (); } /*****************************************************************************/ @@ -1032,6 +1033,7 @@ static void Fig_GetAndShowInstitutionsStats (void) { extern const char *Hlp_ANALYTICS_Figures_institutions; extern const char *Txt_Institutions; + struct Fig_Figures Figures; /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Institutions, @@ -1040,7 +1042,9 @@ static void Fig_GetAndShowInstitutionsStats (void) /***** Form to select type of list used to display degree photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); - Usr_ShowFormsToSelectUsrListType (Fig_PutHiddenParamFigures,&Gbl); + Figures.Scope = Gbl.Scope.Current; + Figures.FigureType = Fig_INSTITS; + Usr_ShowFormsToSelectUsrListType (Fig_PutHiddenParamFigures,&Figures); /***** Institutions ordered by number of centres *****/ Fig_GetAndShowInssOrderedByNumCtrs (); diff --git a/swad_figure.h b/swad_figure.h index 2734752d..268902ff 100644 --- a/swad_figure.h +++ b/swad_figure.h @@ -27,6 +27,8 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include "swad_hierarchy.h" + /*****************************************************************************/ /************************** Public types and constants ***********************/ /*****************************************************************************/ @@ -68,13 +70,19 @@ typedef enum #define Fig_NUM_STAT_CRS_FILE_ZONES 12 +struct Fig_Figures + { + Hie_Level_t Scope; + Fig_FigureType_t FigureType; + }; + /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ void Fig_ReqShowFigures (void); -void Fig_PutIconToShowFigure (void); -void Fig_PutHiddenParamFigures (void *Args); +void Fig_PutIconToShowFigure (Fig_FigureType_t FigureType); +void Fig_PutHiddenParamFigures (void *Figures); void Fig_ShowFigures (void); #endif diff --git a/swad_file_browser.c b/swad_file_browser.c index 2a3ae1ec..714f7fb7 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3762,10 +3762,7 @@ static void Brw_PutIconsFileBrowser (void *Args) static void Brw_PutIconShowFigure (void *Args) { if (Args) - { - Gbl.Figures.FigureType = Fig_FOLDERS_AND_FILES; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_FOLDERS_AND_FILES); } /*****************************************************************************/ diff --git a/swad_follow.c b/swad_follow.c index 08d56b01..bc1e6bf3 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -427,8 +427,7 @@ static void Fol_PutIconsWhoToFollow (void *Args) Fol_PutIconToUpdateWhoToFollow (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_FOLLOW; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_FOLLOW); } } diff --git a/swad_forum.c b/swad_forum.c index f9f063d2..dfa45e9e 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1716,11 +1716,8 @@ static void For_ShowForumList (void) static void For_PutIconsForums (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_FORUMS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_FORUMS); } /*****************************************************************************/ diff --git a/swad_game.c b/swad_game.c index 28b5dd1f..afb45d4d 100644 --- a/swad_game.c +++ b/swad_game.c @@ -342,8 +342,7 @@ static void Gam_PutIconsListGames (void *Args) } /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_GAMES; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_GAMES); } } diff --git a/swad_global.c b/swad_global.c index 94af509e..4ca2d385 100644 --- a/swad_global.c +++ b/swad_global.c @@ -332,7 +332,6 @@ void Gbl_InitializeGlobals (void) Gbl.Stat.Role = Sta_ROLE_DEFAULT; Gbl.Stat.NumAction = Sta_NUM_ACTION_DEFAULT; Gbl.Stat.RowsPerPage = Sta_DEF_ROWS_PER_PAGE; - Gbl.Figures.FigureType = Fig_FIGURE_TYPE_DEF; Gbl.Scope.Current = Hie_CRS; diff --git a/swad_global.h b/swad_global.h index 86cd105c..d8e326d1 100644 --- a/swad_global.h +++ b/swad_global.h @@ -633,10 +633,6 @@ struct Globals Dat_StartEndTime_t SelectedOrder; unsigned CurrentPage; } Svys; - struct - { - Fig_FigureType_t FigureType; - } Figures; struct { Sta_ClicksGroupedBy_t ClicksGroupedBy; diff --git a/swad_icon.c b/swad_icon.c index 28d33191..3a10053c 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -150,11 +150,8 @@ void Ico_PutIconsToSelectIconSet (void) static void Ico_PutIconsIconSet (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_ICON_SETS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_ICON_SETS); } /*****************************************************************************/ diff --git a/swad_institution.c b/swad_institution.c index aeee95be..3b700347 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -358,8 +358,7 @@ static void Ins_PutIconsListingInstitutions (void *Args) Ins_PutIconToEditInstitutions (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_INSTITS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_INSTITS); } } @@ -595,8 +594,7 @@ static void Ins_PutIconsEditingInstitutions (void *Args) Ins_PutIconToViewInstitutions (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_INSTITS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_INSTITS); } } diff --git a/swad_language.c b/swad_language.c index baba4c19..06708247 100644 --- a/swad_language.c +++ b/swad_language.c @@ -104,11 +104,8 @@ void Lan_PutBoxToSelectLanguage (void) static void Lan_PutIconsLanguage (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_LANGUAGES; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_LANGUAGES); } /*****************************************************************************/ diff --git a/swad_menu.c b/swad_menu.c index 9f0d8c26..a29053b1 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -304,11 +304,8 @@ void Mnu_PutIconsToSelectMenu (void) static void Mnu_PutIconsMenu (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_MENUS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_MENUS); } /*****************************************************************************/ diff --git a/swad_message.c b/swad_message.c index d21b836a..c2267f97 100644 --- a/swad_message.c +++ b/swad_message.c @@ -2528,8 +2528,7 @@ static void Msg_PutIconsListMsgs (void *Args) Msg_PutHiddenParamsMsgsFilters,&Gbl); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_MESSAGES; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_MESSAGES); } } diff --git a/swad_network.c b/swad_network.c index c82ccfa1..c0d18188 100644 --- a/swad_network.c +++ b/swad_network.c @@ -367,11 +367,8 @@ void Net_ShowFormMyWebsAndSocialNets (void) static void Net_PutIconsWebsSocialNetworks (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_SOCIAL_NETWORKS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_SOCIAL_NETWORKS); } /*****************************************************************************/ diff --git a/swad_notice.c b/swad_notice.c index 6aa0d17a..40a0770e 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -520,8 +520,7 @@ static void Not_PutIconsListNotices (void *Args) Not_PutIconToAddNewNotice (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_NOTICES; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_NOTICES); } } diff --git a/swad_notification.c b/swad_notification.c index 368ea974..a4c2e047 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -618,11 +618,8 @@ void Ntf_ShowMyNotifications (void) static void Ntf_PutIconsNotif (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_NOTIFY_EVENTS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_NOTIFY_EVENTS); } /*****************************************************************************/ diff --git a/swad_privacy.c b/swad_privacy.c index fb0f8262..1ae0f16f 100644 --- a/swad_privacy.c +++ b/swad_privacy.c @@ -139,11 +139,8 @@ void Pri_EditMyPrivacy (void) static void Pri_PutIconsPrivacy (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_PRIVACY; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_PRIVACY); } /*****************************************************************************/ diff --git a/swad_program.c b/swad_program.c index 994c3755..e82e1f11 100644 --- a/swad_program.c +++ b/swad_program.c @@ -376,8 +376,7 @@ static void Prg_PutIconsListItems (void *Args) Prg_PutIconToCreateNewItem (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_COURSE_PROGRAMS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_COURSE_PROGRAMS); } } diff --git a/swad_project.c b/swad_project.c index a98615e2..96c2ac2f 100644 --- a/swad_project.c +++ b/swad_project.c @@ -1021,8 +1021,7 @@ static void Prj_PutIconsListProjects (void *Args) NULL,NULL); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_PROJECTS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_PROJECTS); } } diff --git a/swad_setting.c b/swad_setting.c index 5b7c2c40..8d368de7 100644 --- a/swad_setting.c +++ b/swad_setting.c @@ -280,11 +280,8 @@ static void Set_PutIconsToSelectSideCols (void) static void Set_PutIconsSideColumns (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_SIDE_COLUMNS; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_SIDE_COLUMNS); } /*****************************************************************************/ diff --git a/swad_survey.c b/swad_survey.c index 046f8d4a..ea726a90 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -337,8 +337,7 @@ static void Svy_PutIconsListSurveys (void *Args) Svy_PutIconToCreateNewSvy (); /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_SURVEYS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_SURVEYS); } } diff --git a/swad_test.c b/swad_test.c index 3f24be08..7fd12e30 100644 --- a/swad_test.c +++ b/swad_test.c @@ -1428,8 +1428,7 @@ static void Tst_PutIconsTests (void *TestPtr) } /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_TESTS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_TESTS); } } diff --git a/swad_theme.c b/swad_theme.c index c0a88087..d7c04fe8 100644 --- a/swad_theme.c +++ b/swad_theme.c @@ -350,11 +350,8 @@ void The_PutIconsToSelectTheme (void) static void The_PutIconsTheme (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_THEMES; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_THEMES); } /*****************************************************************************/ diff --git a/swad_timeline.c b/swad_timeline.c index 4ce7d514..05905a41 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1163,11 +1163,8 @@ static void TL_ShowTimeline (char *Query, static void TL_PutIconsTimeline (void *Args) { if (Args) - { /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_TIMELINE; - Fig_PutIconToShowFigure (); - } + Fig_PutIconToShowFigure (Fig_TIMELINE); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index e972ca69..d4bb9a03 100644 --- a/swad_user.c +++ b/swad_user.c @@ -8783,8 +8783,7 @@ static void Usr_PutIconsListGsts (void *Args) } /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_USERS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_USERS); } } @@ -8812,8 +8811,7 @@ static void Usr_PutIconsListStds (void *Args) } /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_USERS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_USERS); } } @@ -8841,8 +8839,7 @@ static void Usr_PutIconsListTchs (void *Args) } /***** Put icon to show a figure *****/ - Gbl.Figures.FigureType = Fig_USERS; - Fig_PutIconToShowFigure (); + Fig_PutIconToShowFigure (Fig_USERS); } }