From f22eebe314f40ff95e889a8c941e0aa1bc05a397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 5 Nov 2019 08:46:38 +0100 Subject: [PATCH] Version19.52 --- swad_HTML.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ swad_HTML.h | 3 +++ swad_attendance.c | 2 +- swad_centre.c | 14 ++++++------ swad_changelog.h | 3 ++- swad_country.c | 2 +- swad_course.c | 19 ++++++++-------- swad_date.c | 18 +++++++-------- swad_degree.c | 12 +++++----- swad_degree_type.c | 2 +- swad_department.c | 6 ++--- swad_enrolment.c | 3 ++- swad_exam.c | 14 ++++++------ swad_figure.c | 2 +- swad_file_browser.c | 7 +++--- swad_group.c | 24 ++++++++++---------- swad_holiday.c | 8 +++---- swad_institution.c | 8 +++---- swad_language.c | 3 ++- swad_message.c | 2 +- swad_photo.c | 8 +++---- swad_project.c | 4 ++-- swad_record.c | 30 ++++++++++++------------- swad_role.c | 2 +- swad_scope.c | 3 ++- swad_search.c | 2 +- swad_statistic.c | 15 +++++++------ swad_test.c | 9 ++++---- swad_timetable.c | 6 ++--- swad_user.c | 5 ++--- 30 files changed, 177 insertions(+), 114 deletions(-) diff --git a/swad_HTML.c b/swad_HTML.c index d135657a..6edb514c 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -66,6 +66,7 @@ static unsigned HTM_A_NestingLevel = 0; static unsigned HTM_SCRIPT_NestingLevel = 0; static unsigned HTM_LABEL_NestingLevel = 0; static unsigned HTM_TEXTAREA_NestingLevel = 0; +// static unsigned HTM_SELECT_NestingLevel = 0; /*****************************************************************************/ /***************************** Private prototypes ****************************/ @@ -91,6 +92,8 @@ static void HTM_LABEL_BeginWithoutAttr (void); static void HTM_TEXTAREA_BeginWithoutAttr (void); +static void HTM_SELECT_BeginWithoutAttr (void); + /*****************************************************************************/ /******************************* Start/end table *****************************/ /*****************************************************************************/ @@ -1151,6 +1154,58 @@ void HTM_TEXTAREA_End (void) HTM_TEXTAREA_NestingLevel--; } +/*****************************************************************************/ +/********************************** Selectors ********************************/ +/*****************************************************************************/ + +void HTM_SELECT_Begin (const char *fmt,...) + { + va_list ap; + int NumBytesPrinted; + char *Attr; + + if (fmt) + { + if (fmt[0]) + { + va_start (ap,fmt); + NumBytesPrinted = vasprintf (&Attr,fmt,ap); + va_end (ap); + + if (NumBytesPrinted < 0) // If memory allocation wasn't possible, + // or some other error occurs, + // vasprintf will return -1 + Lay_NotEnoughMemoryExit (); + + /***** Print HTML *****/ + fprintf (Gbl.F.Out,""); + } + +void HTM_SELECT_End (void) + { + // if (HTM_SELECT_NestingLevel == 0) // No SELECT open + // Ale_ShowAlert (Ale_ERROR,"Trying to close unopened SELECT."); + + fprintf (Gbl.F.Out,""); + + // HTM_SELECT_NestingLevel--; + } + /*****************************************************************************/ /********************************** Images ***********************************/ /*****************************************************************************/ diff --git a/swad_HTML.h b/swad_HTML.h index f71d3617..6852affa 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -113,6 +113,9 @@ void HTM_INPUT_CHECKBOX (const char *Name,bool SubmitOnChange, void HTM_TEXTAREA_Begin (const char *fmt,...); void HTM_TEXTAREA_End (void); +void HTM_SELECT_Begin (const char *fmt,...); +void HTM_SELECT_End (void); + void HTM_IMG (const char *URL,const char *Icon,const char *Title, const char *fmt,...); diff --git a/swad_attendance.c b/swad_attendance.c index d968b883..397a9e6a 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1143,7 +1143,7 @@ void Att_RequestCreatOrEditAttEvent (void) fprintf (Gbl.F.Out,">%s", Txt_Visible_MALE_PLURAL); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_centre.c b/swad_centre.c index 9ce1a455..946dd196 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -440,7 +440,7 @@ static void Ctr_Configuration (bool PrintView) Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); /* Free list of institutions */ @@ -540,7 +540,7 @@ static void Ctr_Configuration (bool PrintView) (Gbl.Plcs.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Ctr.PlcCod) ? " selected=\"selected\"" : "", Gbl.Plcs.Lst[NumPlc].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); /* Free list of places */ @@ -1447,7 +1447,7 @@ void Ctr_WriteSelectorOfCentre (void) } /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } @@ -1531,7 +1531,7 @@ static void Ctr_ListCentresForEdition (void) (Gbl.Plcs.Lst[NumPlc].PlcCod == Ctr->PlcCod) ? " selected=\"selected\"" : "", Gbl.Plcs.Lst[NumPlc].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } else @@ -1626,13 +1626,13 @@ static void Ctr_ListCentresForEdition (void) fprintf (Gbl.F.Out,"", + "", Gbl.Form.Id, (unsigned) Ctr_GetStatusBitsFromStatusTxt (Ctr_STATUS_PENDING), Txt_CENTRE_STATUS[Ctr_STATUS_PENDING], (unsigned) Ctr_GetStatusBitsFromStatusTxt (Ctr_STATUS_ACTIVE), Txt_CENTRE_STATUS[Ctr_STATUS_ACTIVE]); + HTM_SELECT_End (); Frm_EndForm (); } else if (StatusTxt != Ctr_STATUS_ACTIVE) // If active ==> do not show anything @@ -2515,7 +2515,7 @@ static void Ctr_PutFormToCreateCentre (void) (Gbl.Plcs.Lst[NumPlc].PlcCod == Ctr_EditingCtr->PlcCod) ? " selected=\"selected\"" : "", Gbl.Plcs.Lst[NumPlc].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Centre short name *****/ diff --git a/swad_changelog.h b/swad_changelog.h index 7257b071..2be5961b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,7 +490,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.51.25 (2019-11-05)" +#define Log_PLATFORM_VERSION "SWAD 19.52 (2019-11-05)" #define CSS_FILE "swad19.47.css" #define JS_FILE "swad19.39.js" /* @@ -498,6 +498,7 @@ ps2pdf source.ps destination.pdf // TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: Importante: filtrar proyectos por usuarios (igual que en trabajos o en asistencia) + Version 19.52: Nov 05, 2019 Code refactoring in HTML selects. (245959 lines) Version 19.51.25: Nov 05, 2019 Fixed bug in file browser. (245909 lines) Version 19.51.24: Nov 05, 2019 Fixed bug in tests. (245908 lines) Version 19.51.23: Nov 04, 2019 Fixed bug in forms. (245907 lines) diff --git a/swad_country.c b/swad_country.c index 90e73113..d9d00e30 100644 --- a/swad_country.c +++ b/swad_country.c @@ -1272,7 +1272,7 @@ void Cty_WriteSelectorOfCountry (void) DB_FreeMySQLResult (&mysql_res); /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } diff --git a/swad_course.c b/swad_course.c index 2ebaf7c4..a8aa7547 100644 --- a/swad_course.c +++ b/swad_course.c @@ -265,7 +265,7 @@ static void Crs_Configuration (bool PrintView) Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].DegCod == Gbl.Hierarchy.Deg.DegCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); /* Free list of degrees of the current centre */ @@ -355,7 +355,7 @@ static void Crs_Configuration (bool PrintView) Year == Gbl.Hierarchy.Crs.Year ? " selected=\"selected\"" : "", Txt_YEAR_OF_DEGREE[Year]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } else @@ -934,7 +934,7 @@ void Crs_WriteSelectorOfCourse (void) } /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } @@ -1114,7 +1114,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) Gbl.Hierarchy.Crs.ShrtName); /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } @@ -1494,7 +1494,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) YearAux == Crs->Year ? " selected=\"selected\"" : "", Txt_YEAR_OF_DEGREE[YearAux]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } else @@ -1558,13 +1558,13 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) fprintf (Gbl.F.Out,"", + "", Gbl.Form.Id, (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_PENDING), Txt_COURSE_STATUS[Crs_STATUS_PENDING], (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_ACTIVE), Txt_COURSE_STATUS[Crs_STATUS_ACTIVE]); + HTM_SELECT_End (); Frm_EndForm (); } else if (StatusTxt != Crs_STATUS_ACTIVE) // If active ==> do not show anything @@ -1686,7 +1686,7 @@ static void Crs_PutFormToCreateCourse (void) Year == Crs_EditingCrs->Year ? " selected=\"selected\"" : "", Txt_YEAR_OF_DEGREE[Year]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Course short name *****/ @@ -3301,7 +3301,8 @@ void Crs_AskRemoveOldCrss (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",i); } - fprintf (Gbl.F.Out," "); + HTM_SELECT_End (); + fprintf (Gbl.F.Out," "); fprintf (Gbl.F.Out,Txt_Eliminate_all_courses_whithout_users_PART_2_OF_2, Cfg_PLATFORM_SHORT_NAME); HTM_LABEL_End (); diff --git a/swad_date.c b/swad_date.c index a5aa95b8..af867678 100644 --- a/swad_date.c +++ b/swad_date.c @@ -576,7 +576,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Year++) fprintf (Gbl.F.Out,"", Year,Year); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Month *****/ @@ -595,7 +595,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Month++) fprintf (Gbl.F.Out,"", Month,Txt_MONTHS_SMALL[Month - 1]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Day *****/ @@ -612,7 +612,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Day++) fprintf (Gbl.F.Out,"", Day,Day); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Hour *****/ @@ -629,7 +629,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Hour++) fprintf (Gbl.F.Out,"", Hour,Hour); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Minute *****/ @@ -648,7 +648,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, fprintf (Gbl.F.Out,"", Minute,Minute); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Second *****/ @@ -667,7 +667,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Second++) fprintf (Gbl.F.Out,"", Second,Second); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); } @@ -846,7 +846,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",Year); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Month *****/ @@ -870,7 +870,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_MONTHS_SMALL[Month - 1]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Day *****/ @@ -894,7 +894,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",Day); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** End table *****/ diff --git a/swad_degree.c b/swad_degree.c index a4de8f8a..58c1386a 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -369,7 +369,7 @@ static void Deg_Configuration (bool PrintView) Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); /* Free list of centres */ @@ -645,7 +645,7 @@ void Deg_WriteSelectorOfDegree (void) } /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } @@ -783,7 +783,7 @@ static void Deg_ListDegreesForEdition (void) "", DegTyp->DegTypName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } else @@ -840,13 +840,13 @@ static void Deg_ListDegreesForEdition (void) fprintf (Gbl.F.Out,"", + "", Gbl.Form.Id, (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_PENDING), Txt_DEGREE_STATUS[Deg_STATUS_PENDING], (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_ACTIVE), Txt_DEGREE_STATUS[Deg_STATUS_ACTIVE]); + HTM_SELECT_End (); Frm_EndForm (); } else if (StatusTxt != Deg_STATUS_ACTIVE) // If active ==> do not show anything @@ -982,7 +982,7 @@ static void Deg_PutFormToCreateDegree (void) "", DegTyp->DegTypName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Degree WWW *****/ diff --git a/swad_degree_type.c b/swad_degree_type.c index d75554a4..f67d1e69 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -129,7 +129,7 @@ void DT_WriteSelectorDegreeTypes (void) fprintf (Gbl.F.Out,">%s",Gbl.DegTypes.Lst[NumDegTyp].DegTypName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); /***** Free list of degree types *****/ DT_FreeListDegreeTypes (); diff --git a/swad_department.c b/swad_department.c index 9b240a94..66ae2a2e 100644 --- a/swad_department.c +++ b/swad_department.c @@ -554,7 +554,7 @@ static void Dpt_ListDepartmentsForEdition (void) Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Dpt->InsCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -931,7 +931,7 @@ static void Dpt_PutFormToCreateDepartment (void) Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Dpt_EditingDpt->InsCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Department short name *****/ @@ -1151,7 +1151,7 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, } /* End selector */ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); /***** Free list of departments *****/ Dpt_FreeListDepartments (); diff --git a/swad_enrolment.c b/swad_enrolment.c index f2d35f78..69c134f6 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -815,7 +815,8 @@ void Enr_AskRemoveOldUsrs (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",Months); } - fprintf (Gbl.F.Out," "); + HTM_SELECT_End (); + fprintf (Gbl.F.Out," "); fprintf (Gbl.F.Out,Txt_Eliminate_all_users_who_are_not_enroled_on_any_courses_PART_2_OF_2, Cfg_PLATFORM_SHORT_NAME); HTM_LABEL_End (); diff --git a/swad_exam.c b/swad_exam.c index fbfbc348..08a048a1 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -1132,7 +1132,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod, "", Year,Txt_YEAR_OF_DEGREE[Year]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else fprintf (Gbl.F.Out,"%s", @@ -1212,8 +1212,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod, fprintf (Gbl.F.Out,">%02u %s", Hour,Txt_hours_ABBREVIATION); } - fprintf (Gbl.F.Out,"" - ""); for (Minute = 0; Minute <= 59; Minute++) @@ -1223,7 +1223,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%02u '",Minute); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else if (Gbl.ExamAnns.ExaDat.StartTime.Hour) fprintf (Gbl.F.Out,"%2u:%02u", @@ -1254,8 +1254,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod, fprintf (Gbl.F.Out,">%02u %s", Hour,Txt_hours_ABBREVIATION); } - fprintf (Gbl.F.Out,"" - ""); for (Minute = 0; Minute <= 59; Minute++) @@ -1265,7 +1265,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%02u '",Minute); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else if (Gbl.ExamAnns.ExaDat.Duration.Hour || Gbl.ExamAnns.ExaDat.Duration.Minute) diff --git a/swad_figure.c b/swad_figure.c index 33f8d89e..78c032f9 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -237,7 +237,7 @@ void Fig_ReqShowFigures (void) "", Txt_FIGURE_TYPES[FigureType]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); /***** Send button and end box *****/ diff --git a/swad_file_browser.c b/swad_file_browser.c index 3c1bb234..a17bdae9 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -9587,7 +9587,7 @@ void Brw_ShowFileMetadata (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_Public_open_educational_resource_OER_for_everyone); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else // I can not edit file properties fprintf (Gbl.F.Out,"%s", @@ -9621,7 +9621,7 @@ void Brw_ShowFileMetadata (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_LICENSES[License]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else // I can not edit file properties fprintf (Gbl.F.Out,"%s",Txt_LICENSES[FileMetadata.License]); @@ -12144,7 +12144,8 @@ void Brw_AskRemoveOldFiles (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",Months); } - fprintf (Gbl.F.Out," "); + HTM_SELECT_End (); + fprintf (Gbl.F.Out," "); fprintf (Gbl.F.Out,Txt_Remove_files_older_than_PART_2_OF_2, Cfg_PLATFORM_SHORT_NAME); HTM_LABEL_End (); diff --git a/swad_group.c b/swad_group.c index 665f616b..127ea57b 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1335,9 +1335,9 @@ static void Grp_ListGroupTypesForEdition (void) Txt_It_is_optional_to_choose_a_group); if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment) fprintf (Gbl.F.Out," selected=\"selected\""); - fprintf (Gbl.F.Out,">%s" - "", + fprintf (Gbl.F.Out,">%s", Txt_It_is_mandatory_to_choose_a_group); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -1357,9 +1357,9 @@ static void Grp_ListGroupTypesForEdition (void) Txt_A_student_can_only_belong_to_one_group); if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment) fprintf (Gbl.F.Out," selected=\"selected\""); - fprintf (Gbl.F.Out,">%s" - "", + fprintf (Gbl.F.Out,">%s", Txt_A_student_can_belong_to_several_groups); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -1565,7 +1565,7 @@ static void Grp_ListGroupsForEdition (void) } /* End selector */ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -1615,7 +1615,7 @@ static void Grp_ListGroupsForEdition (void) } /* End selector */ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -2514,9 +2514,9 @@ static void Grp_PutFormToCreateGroupType (void) Txt_It_is_optional_to_choose_a_group); if (Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment) fprintf (Gbl.F.Out," selected=\"selected\""); - fprintf (Gbl.F.Out,">%s" - "", + fprintf (Gbl.F.Out,">%s", Txt_It_is_mandatory_to_choose_a_group); + HTM_SELECT_End (); HTM_TD_End (); /***** Is it possible to register in multiple groups of this type? *****/ @@ -2531,9 +2531,9 @@ static void Grp_PutFormToCreateGroupType (void) Txt_A_student_can_only_belong_to_one_group); if (Gbl.Crs.Grps.GrpTyp.MultipleEnrolment) fprintf (Gbl.F.Out," selected=\"selected\""); - fprintf (Gbl.F.Out,">%s" - "", + fprintf (Gbl.F.Out,">%s", Txt_A_student_can_belong_to_several_groups); + HTM_SELECT_End (); HTM_TD_End (); /***** Open time *****/ @@ -2643,7 +2643,7 @@ static void Grp_PutFormToCreateGroup (void) } /* End selector */ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Group name *****/ @@ -2685,7 +2685,7 @@ static void Grp_PutFormToCreateGroup (void) } /* End selector */ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Current number of users in this group *****/ diff --git a/swad_holiday.c b/swad_holiday.c index af4a4de7..19f89d02 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -600,7 +600,7 @@ static void Hld_ListHolidaysForEdition (void) Gbl.Plcs.Lst[NumPlc].PlcCod == Hld->PlcCod ? " selected=\"selected\"" : "", Gbl.Plcs.Lst[NumPlc].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -619,7 +619,7 @@ static void Hld_ListHolidaysForEdition (void) HolidayType == Hld->HldTyp ? " selected=\"selected\"" : "", Txt_HOLIDAY_TYPES[HolidayType]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -999,7 +999,7 @@ static void Hld_PutFormToCreateHoliday (void) Gbl.Plcs.Lst[NumPlc].PlcCod == Hld_EditingHld->PlcCod ? " selected=\"selected\"" : "", Gbl.Plcs.Lst[NumPlc].ShrtName); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Holiday type *****/ @@ -1013,7 +1013,7 @@ static void Hld_PutFormToCreateHoliday (void) HolidayType == Hld_EditingHld->HldTyp ? " selected=\"selected\"" : "", Txt_HOLIDAY_TYPES[HolidayType]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); /***** Holiday date / Non school period start date *****/ diff --git a/swad_institution.c b/swad_institution.c index d6fc63ad..730bbd10 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -381,7 +381,7 @@ static void Ins_Configuration (bool PrintView) Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod ? " selected=\"selected\"" : "", Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); /* Free list of countries */ @@ -1418,7 +1418,7 @@ void Ins_WriteSelectorOfInstitution (void) } /***** End form *****/ - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } @@ -1565,13 +1565,13 @@ static void Ins_ListInstitutionsForEdition (void) fprintf (Gbl.F.Out,"", + "", Gbl.Form.Id, (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_PENDING), Txt_INSTITUTION_STATUS[Ins_STATUS_PENDING], (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_ACTIVE), Txt_INSTITUTION_STATUS[Ins_STATUS_ACTIVE]); + HTM_SELECT_End (); Frm_EndForm (); } else if (StatusTxt != Ins_STATUS_ACTIVE) // If active ==> do not show anything diff --git a/swad_language.c b/swad_language.c index 0fa6da9d..ddd635db 100644 --- a/swad_language.c +++ b/swad_language.c @@ -29,6 +29,7 @@ #include "swad_database.h" #include "swad_form.h" #include "swad_global.h" +#include "swad_HTML.h" #include "swad_language.h" #include "swad_setting.h" @@ -128,7 +129,7 @@ void Lan_PutSelectorToSelectLanguage (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STR_LANG_NAME[Lan]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } diff --git a/swad_message.c b/swad_message.c index 28a7b2cb..fb376854 100644 --- a/swad_message.c +++ b/swad_message.c @@ -2633,7 +2633,7 @@ void Msg_ShowFormSelectCourseSentOrRecMsgs (void) fprintf (Gbl.F.Out," selected=\"selected\""); // Select origin course fprintf (Gbl.F.Out,">%s",Gbl.Msg.Courses[NumOriginCrs].ShrtName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); } diff --git a/swad_photo.c b/swad_photo.c index fa0b9fec..b77df5e9 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1809,7 +1809,7 @@ static void Pho_PutSelectorForTypeOfAvg (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_AVERAGE_PHOTO_TYPES[TypeOfAvg]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -1874,7 +1874,7 @@ static void Pho_PutSelectorForHowComputePhotoSize (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_DEGREE_PHOTO_SIZE[PhoSi]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -1939,7 +1939,7 @@ static void Pho_PutSelectorForHowOrderDegrees (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_DEGREE_PHOTO_ORDER[Order]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -2049,7 +2049,7 @@ static void Pho_PutLinkToCalculateDegreeStats (void) Txt_time, StrEstimatedTimeToComputeAvgPhoto); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); /* End form and contextual menu */ Frm_EndForm (); diff --git a/swad_project.c b/swad_project.c index 024ec9ef..4170224c 100644 --- a/swad_project.c +++ b/swad_project.c @@ -3353,7 +3353,7 @@ static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_No); - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); @@ -3390,7 +3390,7 @@ static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_PROJECT_STATUS[Proposal]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_record.c b/swad_record.c index e17b2739..5b6ff9b8 100644 --- a/swad_record.c +++ b/swad_record.c @@ -345,7 +345,7 @@ void Rec_ListFieldsRecordsForEdition (void) fprintf (Gbl.F.Out,">%s", Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); HTM_TR_End (); @@ -410,7 +410,7 @@ void Rec_ShowFormCreateRecordField (void) Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); @@ -1504,8 +1504,8 @@ static void Rec_ShowLinkToPrintPreviewOfRecords (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%u",i); } - fprintf (Gbl.F.Out," %s)", - Txt_record_cards_per_page); + HTM_SELECT_End (); + fprintf (Gbl.F.Out," %s)",Txt_record_cards_per_page); HTM_LABEL_End (); } @@ -2942,7 +2942,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat, fprintf (Gbl.F.Out,">%s", Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); break; case Rec_SHA_OTHER_EXISTING_USR_FORM: // The other user already exists in the platform if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected @@ -3025,7 +3025,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat, default: // The rest of users can not register other users break; } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } else // No course selected { @@ -3038,10 +3038,10 @@ static void Rec_ShowRole (struct UsrData *UsrDat, /***** Selector of role *****/ fprintf (Gbl.F.Out,"", + " disabled=\"disabled\">%s", (unsigned) DefaultRoleInForm, Txt_ROLES_SINGUL_Abc[DefaultRoleInForm][UsrDat->Sex]); + HTM_SELECT_End (); } break; case Rec_SHA_OTHER_NEW_USR_FORM: // The user does not exist in platform @@ -3082,7 +3082,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat, fprintf (Gbl.F.Out,">%s", Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); break; default: // The rest of users can not register other users break; @@ -3094,9 +3094,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat, /***** Selector of role *****/ fprintf (Gbl.F.Out,"", + " selected=\"selected\">%s", (unsigned) Rol_GST,Txt_ROLES_SINGUL_Abc[Rol_GST][Usr_SEX_UNKNOWN]); + HTM_SELECT_End (); break; default: // The rest of users can not register other users break; @@ -3298,7 +3298,7 @@ static void Rec_ShowCountry (struct UsrData *UsrDat, fprintf (Gbl.F.Out,">%s", Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); @@ -4036,7 +4036,7 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out,">%s", Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -4084,7 +4084,7 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out,">%s", Gbl.Hierarchy.Cty.Inss.Lst[NumIns].FullName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -4134,7 +4134,7 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out,">%s", Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].FullName); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); diff --git a/swad_role.c b/swad_role.c index 3aef11e6..04a11d48 100644 --- a/swad_role.c +++ b/swad_role.c @@ -490,7 +490,7 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect) fprintf (Gbl.F.Out,">%s", Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); Frm_EndForm (); } diff --git a/swad_scope.c b/swad_scope.c index ae085b0a..0830a470 100644 --- a/swad_scope.c +++ b/swad_scope.c @@ -29,6 +29,7 @@ #include "swad_config.h" #include "swad_global.h" +#include "swad_HTML.h" #include "swad_parameter.h" #include "swad_scope.h" @@ -162,7 +163,7 @@ void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange) } } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } /*****************************************************************************/ diff --git a/swad_search.c b/swad_search.c index 932b5aff..5ae0ecce 100644 --- a/swad_search.c +++ b/swad_search.c @@ -177,7 +177,7 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Hie fprintf (Gbl.F.Out,">%s", Titles[WhatToSearch]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); /***** Magnifying glass icon *****/ diff --git a/swad_statistic.c b/swad_statistic.c index 1653f099..a43ba226 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -431,7 +431,7 @@ void Sta_AskShowCrsHits (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); /***** Separator *****/ @@ -467,7 +467,8 @@ void Sta_AskShowCrsHits (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%lu",RowsPerPage[i]); } - fprintf (Gbl.F.Out,")"); + HTM_SELECT_End (); + fprintf (Gbl.F.Out,")"); HTM_LABEL_End (); HTM_TD_End (); @@ -557,7 +558,7 @@ void Sta_AskShowGblHits (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_ROLE_STATS[RoleStat]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); @@ -619,7 +620,7 @@ void Sta_AskShowGblHits (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); HTM_TD_End (); @@ -694,7 +695,7 @@ static void Sta_WriteSelectorCountType (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_TYPE_COUNT_SMALL[StatCountType]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); } /*****************************************************************************/ @@ -736,7 +737,7 @@ static void Sta_WriteSelectorAction (void) fprintf (Gbl.F.Out,"%s", Act_GetActionTextFromDB (Act_GetActCod (Action),ActTxt)); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); @@ -2090,7 +2091,7 @@ static void Sta_ShowDistrAccessesPerDayAndHour (unsigned long NumRows,MYSQL_RES fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_STAT_COLOR_TYPES[ColorType]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); HTM_LABEL_End (); Frm_EndForm (); HTM_TD_End (); diff --git a/swad_test.c b/swad_test.c index 8b7c97f5..03a0391e 100644 --- a/swad_test.c +++ b/swad_test.c @@ -3518,11 +3518,11 @@ static void Tst_WriteTFAnsViewTest (unsigned NumQst) fprintf (Gbl.F.Out,"", + "", NumQst, Txt_TF_QST[0], Txt_TF_QST[1]); + HTM_SELECT_End (); } /*****************************************************************************/ @@ -5116,9 +5116,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1], if (TagNotFound && Gbl.Test.Tags.Txt[NumTag][0]) fprintf (Gbl.F.Out,"", Gbl.Test.Tags.Txt[NumTag],Gbl.Test.Tags.Txt[NumTag]); - fprintf (Gbl.F.Out,"" - "", - Txt_new_tag); + fprintf (Gbl.F.Out,"",Txt_new_tag); + HTM_SELECT_End (); HTM_TD_End (); /***** Input of a new tag *****/ diff --git a/swad_timetable.c b/swad_timetable.c index af1f4be1..6ff924e5 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1613,7 +1613,7 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co TT_ClassTypeDB[CT], Txt_TIMETABLE_CLASS_TYPES[CT]); } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); if (IntervalType == TT_FREE_INTERVAL) { @@ -1659,7 +1659,7 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co (Dur % Gbl.TimeTable.Config.IntervalsPerHour) * Gbl.TimeTable.Config.Range.MinutesPerInterval); // Minutes } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); if (Gbl.TimeTable.View == TT_CRS_EDIT) { @@ -1701,7 +1701,7 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co fprintf (Gbl.F.Out,""); } } - fprintf (Gbl.F.Out,""); + HTM_SELECT_End (); /***** Info *****/ fprintf (Gbl.F.Out,"
"); diff --git a/swad_user.c b/swad_user.c index e1011ee5..7cba03c5 100644 --- a/swad_user.c +++ b/swad_user.c @@ -8954,9 +8954,8 @@ void Usr_PutSelectorNumColsClassPhoto (void) } /***** End selector *****/ - fprintf (Gbl.F.Out,"" - "%s", - Txt_columns); + HTM_SELECT_End (); + fprintf (Gbl.F.Out,"%s",Txt_columns); HTM_LABEL_End (); }