diff --git a/swad_browser.c b/swad_browser.c index f65c6daa8..a20e7de18 100644 --- a/swad_browser.c +++ b/swad_browser.c @@ -1127,7 +1127,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void); static void Brw_InitHiddenLevels (void); static void Brw_PutCheckboxFullTree (void); -static void Brw_PutParsFullTree (void); +static void Brw_PutParsFullTree (__attribute__((unused)) void *Args); static bool Brw_GetFullTreeFromForm (void); static void Brw_GetAndUpdateDateLastAccFileBrowser (void); @@ -3587,13 +3587,13 @@ static void Brw_PutCheckboxFullTree (void) extern const char *Txt_Show_all_files; Lay_PutContextualCheckbox (Brw_ActSeeAdm[Gbl.FileBrowser.Type], - Brw_PutParsFullTree, + Brw_PutParsFullTree,NULL, "FullTree", Gbl.FileBrowser.FullTree,false, Txt_Show_all_files,Txt_Show_all_files); } -static void Brw_PutParsFullTree (void) +static void Brw_PutParsFullTree (__attribute__((unused)) void *Args) { if (Brw_TypeIsGrpBrw[Gbl.FileBrowser.Type]) ParCod_PutPar (ParCod_Grp,Gbl.Crs.Grps.GrpCod); diff --git a/swad_changelog.h b/swad_changelog.h index 801b823cb..4686a24ad 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -633,10 +633,11 @@ Me sale este error, no s "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') */ -#define Log_PLATFORM_VERSION "SWAD 23.70 (2024-03-19)" +#define Log_PLATFORM_VERSION "SWAD 23.70.1 (2024-03-19)" #define CSS_FILE "swad23.67.2.css" #define JS_FILE "swad23.53.6.js" /* + Version 23.70.1: Mar 19, 2024 Bug fixing in syllabus. (335429 lines) Version 23.70: Mar 19, 2024 Code refactoring and bug fixing in syllabus. (335413 lines) Version 23.69: Mar 14, 2024 Actions defined as enum type. (335591 lines) Version 23.68.1: Mar 14, 2024 Code refactoring in menu icons. (335591 lines) diff --git a/swad_info.c b/swad_info.c index de9ba4f6c..0594b9c1f 100644 --- a/swad_info.c +++ b/swad_info.c @@ -358,21 +358,28 @@ void Inf_PutIconToEditInfo (void *Type) static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead,bool Disabled) { + extern Syl_WhichSyllabus_t Syl_WhichSyllabus[Syl_NUM_WHICH_SYLLABUS]; extern const char *Txt_Force_students_to_read_this_information; - static const Act_Action_t Inf_ActionsChangeForceReadInfo[Inf_NUM_TYPES] = + static struct { - [Inf_INTRODUCTION ] = ActChgFrcReaCrsInf, - [Inf_TEACHING_GUIDE] = ActChgFrcReaTchGui, - [Inf_LECTURES ] = ActChgFrcReaSylLec, - [Inf_PRACTICALS ] = ActChgFrcReaSylPra, - [Inf_BIBLIOGRAPHY ] = ActChgFrcReaBib, - [Inf_FAQ ] = ActChgFrcReaFAQ, - [Inf_LINKS ] = ActChgFrcReaCrsLnk, - [Inf_ASSESSMENT ] = ActChgFrcReaAss, + const Act_Action_t NextAction; + void (*FuncPars) (void *Args); + void *Args; + } Inf_Actions[Inf_NUM_TYPES] = + { + [Inf_INTRODUCTION ] = {ActChgFrcReaCrsInf,NULL,NULL}, + [Inf_TEACHING_GUIDE] = {ActChgFrcReaTchGui,NULL,NULL}, + [Inf_LECTURES ] = {ActChgFrcReaSylLec,Syl_PutParWhichSyllabus,&Syl_WhichSyllabus[Syl_LECTURES ]}, + [Inf_PRACTICALS ] = {ActChgFrcReaSylPra,Syl_PutParWhichSyllabus,&Syl_WhichSyllabus[Syl_PRACTICALS]}, + [Inf_BIBLIOGRAPHY ] = {ActChgFrcReaBib ,NULL,NULL}, + [Inf_FAQ ] = {ActChgFrcReaFAQ ,NULL,NULL}, + [Inf_LINKS ] = {ActChgFrcReaCrsLnk,NULL,NULL}, + [Inf_ASSESSMENT ] = {ActChgFrcReaAss ,NULL,NULL}, }; - Lay_PutContextualCheckbox (Inf_ActionsChangeForceReadInfo[Gbl.Crs.Info.Type], - NULL, + Lay_PutContextualCheckbox (Inf_Actions[Gbl.Crs.Info.Type].NextAction, + Inf_Actions[Gbl.Crs.Info.Type].FuncPars, + Inf_Actions[Gbl.Crs.Info.Type].Args, "MustBeRead", MustBeRead,Disabled, Txt_Force_students_to_read_this_information, @@ -385,22 +392,29 @@ static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead,bool Disabled) static void Inf_PutCheckboxConfirmIHaveReadInfo (void) { + extern Syl_WhichSyllabus_t Syl_WhichSyllabus[Syl_NUM_WHICH_SYLLABUS]; extern const char *Txt_I_have_read_this_information; - static const Act_Action_t Inf_ActionsIHaveReadInfo[Inf_NUM_TYPES] = + static struct { - [Inf_INTRODUCTION ] = ActChgHavReaCrsInf, - [Inf_TEACHING_GUIDE] = ActChgHavReaTchGui, - [Inf_LECTURES ] = ActChgHavReaSylLec, - [Inf_PRACTICALS ] = ActChgHavReaSylPra, - [Inf_BIBLIOGRAPHY ] = ActChgHavReaBib, - [Inf_FAQ ] = ActChgHavReaFAQ, - [Inf_LINKS ] = ActChgHavReaCrsLnk, - [Inf_ASSESSMENT ] = ActChgHavReaAss, + const Act_Action_t NextAction; + void (*FuncPars) (void *Args); + void *Args; + } Inf_Actions[Inf_NUM_TYPES] = + { + [Inf_INTRODUCTION ] = {ActChgHavReaCrsInf,NULL,NULL}, + [Inf_TEACHING_GUIDE] = {ActChgHavReaTchGui,NULL,NULL}, + [Inf_LECTURES ] = {ActChgHavReaSylLec,Syl_PutParWhichSyllabus,&Syl_WhichSyllabus[Syl_LECTURES ]}, + [Inf_PRACTICALS ] = {ActChgHavReaSylPra,Syl_PutParWhichSyllabus,&Syl_WhichSyllabus[Syl_PRACTICALS]}, + [Inf_BIBLIOGRAPHY ] = {ActChgHavReaBib ,NULL,NULL}, + [Inf_FAQ ] = {ActChgHavReaFAQ ,NULL,NULL}, + [Inf_LINKS ] = {ActChgHavReaCrsLnk,NULL,NULL}, + [Inf_ASSESSMENT ] = {ActChgHavReaAss ,NULL,NULL}, }; bool IHaveRead = Inf_DB_CheckIfIHaveReadInfo (); - Lay_PutContextualCheckbox (Inf_ActionsIHaveReadInfo[Gbl.Crs.Info.Type], - NULL, + Lay_PutContextualCheckbox (Inf_Actions[Gbl.Crs.Info.Type].NextAction, + Inf_Actions[Gbl.Crs.Info.Type].FuncPars, + Inf_Actions[Gbl.Crs.Info.Type].Args, "IHaveRead", IHaveRead,false, Txt_I_have_read_this_information, diff --git a/swad_layout.c b/swad_layout.c index 89d5b5263..d7712927f 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1267,7 +1267,7 @@ void Lay_PutContextualLinkIconText (Act_Action_t NextAction,const char *Anchor, /*****************************************************************************/ void Lay_PutContextualCheckbox (Act_Action_t NextAction, - void (*FuncPars) (void), + void (*FuncPars) (void *Args),void *Args, const char *CheckboxName, bool Checked,bool Disabled, const char *Title,const char *Text) @@ -1280,7 +1280,7 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction, /***** Begin form *****/ Frm_BeginForm (NextAction); if (FuncPars) - FuncPars (); + FuncPars (Args); /***** Begin container *****/ HTM_DIV_Begin ("class=\"CONTEXT_OPT %s FORM_OUT_%s BOLD\" title=\"%s\"", diff --git a/swad_layout.h b/swad_layout.h index 45f918d4c..70c497f03 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -79,7 +79,7 @@ void Lay_PutContextualLinkIconText (Act_Action_t NextAction,const char *Anchor, const char *Icon,Ico_Color_t Color, const char *Text,const char *OnSubmit); void Lay_PutContextualCheckbox (Act_Action_t NextAction, - void (*FuncPars) (void), + void (*FuncPars) (void *Args),void *Args, const char *CheckboxName, bool Checked,bool Disabled, const char *Title,const char *Text); diff --git a/swad_notification.c b/swad_notification.c index aa66b965a..235b15142 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -413,7 +413,8 @@ static void Ntf_PutContextualLinks (bool AllNotifications, Mnu_ContextMenuBegin (); /***** Show all notifications *****/ - Lay_PutContextualCheckbox (ActSeeNtf,NULL, + Lay_PutContextualCheckbox (ActSeeNtf, + NULL,NULL, "All", AllNotifications,false, Txt_Show_all_notifications, diff --git a/swad_record.c b/swad_record.c index de305b47a..52d83b081 100644 --- a/swad_record.c +++ b/swad_record.c @@ -122,8 +122,8 @@ static void Rec_ShowLinkToPrintPreviewOfRecords (void); static void Rec_GetParRecordsPerPage (void); static void Rec_WriteFormShowOfficeHoursOneTch (bool ShowOfficeHours); static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours); -static void Rec_PutParsShowOfficeHoursOneTch (void); -static void Rec_PutParsShowOfficeHoursSeveralTchs (void); +static void Rec_PutParsShowOfficeHoursOneTch (__attribute__((unused)) void *Args); +static void Rec_PutParsShowOfficeHoursSeveralTchs (__attribute__((unused)) void *Args); static bool Rec_GetParShowOfficeHours (void); static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, struct Usr_Data *UsrDat,const char *Anchor); @@ -1437,7 +1437,7 @@ static void Rec_WriteFormShowOfficeHoursOneTch (bool ShowOfficeHours) extern const char *Txt_Show_tutoring_hours; Lay_PutContextualCheckbox (ActSeeRecOneTch, - Rec_PutParsShowOfficeHoursOneTch, + Rec_PutParsShowOfficeHoursOneTch,NULL, "ShowOfficeHours", ShowOfficeHours,false, Txt_Show_tutoring_hours, @@ -1449,20 +1449,20 @@ static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours) extern const char *Txt_Show_tutoring_hours; Lay_PutContextualCheckbox (ActSeeRecSevTch, - Rec_PutParsShowOfficeHoursSeveralTchs, + Rec_PutParsShowOfficeHoursSeveralTchs,NULL, "ShowOfficeHours", ShowOfficeHours,false, Txt_Show_tutoring_hours, Txt_Show_tutoring_hours); } -static void Rec_PutParsShowOfficeHoursOneTch (void) +static void Rec_PutParsShowOfficeHoursOneTch (__attribute__((unused)) void *Args) { Usr_PutParOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod); Par_PutParChar ("ParamOfficeHours",'Y'); } -static void Rec_PutParsShowOfficeHoursSeveralTchs (void) +static void Rec_PutParsShowOfficeHoursSeveralTchs (__attribute__((unused)) void *Args) { Usr_PutParSelectedUsrsCods (&Gbl.Usrs.Selected); Par_PutParChar ("ParamOfficeHours",'Y');