From 0796f50539a93512ff728639b933791d912fcf66 Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 18 May 2023 12:54:43 +0200 Subject: [PATCH] Version 22.112: May 18, 2023 Code refactoring in options of selectors. --- swad_HTML.c | 4 +- swad_HTML.h | 12 ++++-- swad_attendance.c | 6 ++- swad_browser.c | 12 ++++-- swad_call_for_exam.c | 18 ++++++--- swad_center.c | 18 ++++++--- swad_center_config.c | 9 +++-- swad_changelog.h | 3 +- swad_country.c | 6 ++- swad_course.c | 22 +++++++---- swad_course_config.c | 6 ++- swad_date.c | 27 +++++++------ swad_degree.c | 12 ++++-- swad_degree_config.c | 3 +- swad_degree_type.c | 6 ++- swad_department.c | 21 ++++++---- swad_enrolment.c | 3 +- swad_exam_print.c | 9 +++-- swad_figure.c | 3 +- swad_group.c | 48 +++++++++++++++-------- swad_hierarchy.c | 4 +- swad_holiday.c | 18 ++++++--- swad_institution.c | 6 ++- swad_institution_config.c | 3 +- swad_language.c | 3 +- swad_message.c | 6 ++- swad_photo.c | 18 +++++---- swad_project.c | 12 ++++-- swad_project_config.c | 9 +++-- swad_question.c | 10 ++--- swad_record.c | 56 +++++++++++++++++---------- swad_role.c | 3 +- swad_room.c | 12 ++++-- swad_scope.c | 81 ++++++++++++--------------------------- swad_search.c | 3 +- swad_statistic.c | 24 ++++++++---- swad_test_print.c | 9 +++-- swad_timetable.c | 12 ++++-- swad_user.c | 3 +- 39 files changed, 322 insertions(+), 218 deletions(-) diff --git a/swad_HTML.c b/swad_HTML.c index 8b2bc8ea..3a4a40d6 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -1736,7 +1736,7 @@ void HTM_OPTGROUP_End (void) } void HTM_OPTION (HTM_Type_t Type,const void *ValuePtr, - bool Selected,HTM_OptionEnabled_t Disabled, + HTM_OptionSelected_t Selected,HTM_OptionDisabled_t Disabled, const char *fmt,...) { va_list ap; @@ -1757,7 +1757,7 @@ void HTM_OPTION (HTM_Type_t Type,const void *ValuePtr, break; } HTM_Txt ("\""); - if (Selected) + if (Selected == HTM_OPTION_SELECTED) HTM_Txt (" selected=\"selected\""); if (Disabled == HTM_OPTION_DISABLED) HTM_Txt (" disabled=\"disabled\""); diff --git a/swad_HTML.h b/swad_HTML.h index 7676a28f..501b213a 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -54,9 +54,15 @@ typedef enum typedef enum { - HTM_OPTION_DISABLED, + HTM_OPTION_UNSELECTED, + HTM_OPTION_SELECTED, + } HTM_OptionSelected_t; + +typedef enum + { HTM_OPTION_ENABLED, - } HTM_OptionEnabled_t; + HTM_OPTION_DISABLED, + } HTM_OptionDisabled_t; #define HTM_NUM_HEAD_ALIGN 3 typedef enum @@ -198,7 +204,7 @@ void HTM_SELECT_End (void); void HTM_OPTGROUP_Begin (const char *Label); void HTM_OPTGROUP_End (void); void HTM_OPTION (HTM_Type_t Type,const void *ValuePtr, - bool Selected,HTM_OptionEnabled_t Disabled, + HTM_OptionSelected_t Selected,HTM_OptionDisabled_t Disabled, const char *fmt,...); void HTM_IMG (const char *URL,const char *Icon,const char *Title, diff --git a/swad_attendance.c b/swad_attendance.c index f7011068..2ac93eff 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1030,11 +1030,13 @@ void Att_ReqCreatOrEditEvent (void) " class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Events.Event.CommentTchVisible, // Selected? + Events.Event.CommentTchVisible ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_Hidden_MALE_PLURAL); HTM_OPTION (HTM_Type_STRING,"Y", - Events.Event.CommentTchVisible, // Selected? + Events.Event.CommentTchVisible ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Visible_MALE_PLURAL); HTM_SELECT_End (); diff --git a/swad_browser.c b/swad_browser.c index 1f05a0ac..0d69562c 100644 --- a/swad_browser.c +++ b/swad_browser.c @@ -7713,11 +7713,13 @@ void Brw_ShowFileMetadata (void) HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, "id=\"PublicFile\" name=\"PublicFile\" class=\"PUBLIC_FILE\""); HTM_OPTION (HTM_Type_STRING,"N", - !FileMetadata.IsPublic, // Selected? + FileMetadata.IsPublic ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_Private_available_to_certain_users_identified); HTM_OPTION (HTM_Type_STRING,"Y", - FileMetadata.IsPublic, // Selected? + FileMetadata.IsPublic ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Public_open_educational_resource_OER_for_everyone); HTM_SELECT_End (); @@ -7750,7 +7752,8 @@ void Brw_ShowFileMetadata (void) { LicenseUnsigned = (unsigned) License; HTM_OPTION (HTM_Type_UNSIGNED,&LicenseUnsigned, - License == FileMetadata.License, // Selected? + License == FileMetadata.License ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_LICENSES[License]); } @@ -9746,7 +9749,8 @@ void Brw_AskRemoveOldFilesBriefcase (void) Months <= Brw_MAX_MONTHS_IN_BRIEFCASE; Months++) HTM_OPTION (HTM_Type_UNSIGNED,&Months, - Months == Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES, // Selected? + Months == Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Months); HTM_SELECT_End (); diff --git a/swad_call_for_exam.c b/swad_call_for_exam.c index d72d231a..3d4dcfff 100644 --- a/swad_call_for_exam.c +++ b/swad_call_for_exam.c @@ -1036,7 +1036,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == CallsForExams->CallForExam.Year, // Selected + Year == CallsForExams->CallForExam.Year ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); @@ -1121,14 +1122,16 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, " class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - CallsForExams->CallForExam.StartTime.Hour == 0, // Selected? + CallsForExams->CallForExam.StartTime.Hour == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "-"); for (Hour = 7; Hour <= 22; Hour++) HTM_OPTION (HTM_Type_UNSIGNED,&Hour, - Hour == CallsForExams->CallForExam.StartTime.Hour, // Selected? + Hour == CallsForExams->CallForExam.StartTime.Hour ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u %s",Hour,Txt_hours_ABBREVIATION); HTM_SELECT_End (); @@ -1140,7 +1143,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Minute <= 59; Minute++) HTM_OPTION (HTM_Type_UNSIGNED,&Minute, - Minute == CallsForExams->CallForExam.StartTime.Minute, // Selected? + Minute == CallsForExams->CallForExam.StartTime.Minute ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u ′",Minute); HTM_SELECT_End (); @@ -1174,7 +1178,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Hour <= 8; Hour++) HTM_OPTION (HTM_Type_UNSIGNED,&Hour, - Hour == CallsForExams->CallForExam.Duration.Hour, // Selected? + Hour == CallsForExams->CallForExam.Duration.Hour ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u %s",Hour,Txt_hours_ABBREVIATION); HTM_SELECT_End (); @@ -1187,7 +1192,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Minute <= 59; Minute++) HTM_OPTION (HTM_Type_UNSIGNED,&Minute, - Minute == CallsForExams->CallForExam.Duration.Minute, // Selected? + Minute == CallsForExams->CallForExam.Duration.Minute ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u ′",Minute); HTM_SELECT_End (); diff --git a/swad_center.c b/swad_center.c index 8c8dd843..0eb589a1 100644 --- a/swad_center.c +++ b/swad_center.c @@ -671,7 +671,8 @@ void Ctr_WriteSelectorOfCenter (void) " disabled=\"disabled\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Ctr.CtrCod < 0, // Selected? + Gbl.Hierarchy.Ctr.CtrCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_Center); @@ -693,7 +694,8 @@ void Ctr_WriteSelectorOfCenter (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&CtrCod, Gbl.Hierarchy.Ctr.CtrCod > 0 && - CtrCod == Gbl.Hierarchy.Ctr.CtrCod, // Selected? + CtrCod == Gbl.Hierarchy.Ctr.CtrCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); } @@ -787,7 +789,8 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places) " class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - Ctr->PlcCod == 0, // Selected? + Ctr->PlcCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_place); for (NumPlc = 0; @@ -796,7 +799,8 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places) { PlcInLst = &Places->Lst[NumPlc]; HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, - PlcInLst->PlcCod == Ctr->PlcCod, // Selected? + PlcInLst->PlcCod == Ctr->PlcCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",PlcInLst->ShrtName); } @@ -1277,7 +1281,8 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places) "name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - Ctr_EditingCtr->PlcCod == 0, // Selected? + Ctr_EditingCtr->PlcCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_place); for (NumPlc = 0; @@ -1286,7 +1291,8 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places) { PlcInLst = &Places->Lst[NumPlc]; HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, - PlcInLst->PlcCod == Ctr_EditingCtr->PlcCod, // Selected? + PlcInLst->PlcCod == Ctr_EditingCtr->PlcCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",PlcInLst->ShrtName); } diff --git a/swad_center_config.c b/swad_center_config.c index 7e617312..bb282bb6 100644 --- a/swad_center_config.c +++ b/swad_center_config.c @@ -575,7 +575,8 @@ static void CtrCfg_Institution (bool PrintView,bool PutForm) { InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, - InsInLst->InsCod == Gbl.Hierarchy.Ins.InsCod, // Selected? + InsInLst->InsCod == Gbl.Hierarchy.Ins.InsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",InsInLst->ShrtName); } @@ -674,7 +675,8 @@ static void CtrCfg_Place (bool PutForm) " class=\"INPUT_SHORT_NAME INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Hierarchy.Ctr.PlcCod == 0, // Selected? + Gbl.Hierarchy.Ctr.PlcCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_place); for (NumPlc = 0; @@ -683,7 +685,8 @@ static void CtrCfg_Place (bool PutForm) { PlcInLst = &Places.Lst[NumPlc]; HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, - PlcInLst->PlcCod == Gbl.Hierarchy.Ctr.PlcCod, // Selected? + PlcInLst->PlcCod == Gbl.Hierarchy.Ctr.PlcCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",PlcInLst->ShrtName); } diff --git a/swad_changelog.h b/swad_changelog.h index f7317dd5..476a97f7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. */ -#define Log_PLATFORM_VERSION "SWAD 22.111 (2023-05-17)" +#define Log_PLATFORM_VERSION "SWAD 22.112 (2023-05-18)" #define CSS_FILE "swad22.107.36.css" #define JS_FILE "swad22.49.js" /* + Version 22.112: May 18, 2023 Code refactoring in options of selectors. (336794 lines) Version 22.111: May 17, 2023 A project can have more than one rubric in each category. (336691 lines) Version 22.110.3: May 15, 2023 Changes in rubrics. (336550 lines) Version 22.110.2: May 15, 2023 Changes in rubrics. (336507 lines) diff --git a/swad_country.c b/swad_country.c index 82ba391f..2b2fb7ce 100644 --- a/swad_country.c +++ b/swad_country.c @@ -872,7 +872,8 @@ void Cty_WriteSelectorOfCountry (void) /***** Initial disabled option *****/ HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Cty.CtyCod < 0, // Selected? + Gbl.Hierarchy.Cty.CtyCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_Country); @@ -883,7 +884,8 @@ void Cty_WriteSelectorOfCountry (void) { CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, - CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod, // Selected? + CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CtyInLst->Name[Gbl.Prefs.Language]); } diff --git a/swad_course.c b/swad_course.c index 87337355..9d77e34b 100644 --- a/swad_course.c +++ b/swad_course.c @@ -642,7 +642,8 @@ void Crs_WriteSelectorOfCourse (void) /***** Initial disabled option *****/ HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Crs.CrsCod < 0, // Selected? + Gbl.Hierarchy.Crs.CrsCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_Course); @@ -664,7 +665,8 @@ void Crs_WriteSelectorOfCourse (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&CrsCod, Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected - CrsCod == Gbl.Hierarchy.Crs.CrsCod, + CrsCod == Gbl.Hierarchy.Crs.CrsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); // Short name (row[1]) } @@ -779,7 +781,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) /***** Write an option when no course selected *****/ if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected HTM_OPTION (HTM_Type_STRING,"-1", - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_DISABLED, "%s",Txt_Course); @@ -804,7 +806,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) } HTM_OPTION (HTM_Type_LONG,&CrsCod, - CrsCod == Gbl.Hierarchy.Crs.CrsCod, // Selected? + CrsCod == Gbl.Hierarchy.Crs.CrsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CrsShortName); } @@ -818,7 +821,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) if (Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected !Gbl.Usrs.Me.IBelongToCurrentCrs) // I do not belong to it HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Crs.CrsCod, - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_DISABLED, "%s",Gbl.Hierarchy.Crs.ShrtName); @@ -1187,7 +1190,8 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) // because it's possible to move this course // to another degree (with other active years) HTM_OPTION (HTM_Type_UNSIGNED,&YearAux, - YearAux == Crs->Year, // Selected? + YearAux == Crs->Year ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_YEAR_OF_DEGREE[YearAux]); HTM_SELECT_End (); @@ -1329,7 +1333,8 @@ static void Crs_PutFormToCreateCourse (void) Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == Crs_EditingCrs->Year, // Selected? + Year == Crs_EditingCrs->Year ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); @@ -2521,7 +2526,8 @@ void Crs_AskRemoveOldCrss (void) i <= Crs_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS; i++) HTM_OPTION (HTM_Type_UNSIGNED,&i, - i == MonthsWithoutAccess, // Selected? + i == MonthsWithoutAccess ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",i); HTM_SELECT_End (); diff --git a/swad_course_config.c b/swad_course_config.c index 92641467..8410f35a 100644 --- a/swad_course_config.c +++ b/swad_course_config.c @@ -243,7 +243,8 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm) { DegInLst = &Gbl.Hierarchy.Degs.Lst[NumDeg]; HTM_OPTION (HTM_Type_LONG,&DegInLst->DegCod, - DegInLst->DegCod == Gbl.Hierarchy.Deg.DegCod, // Selected? + DegInLst->DegCod == Gbl.Hierarchy.Deg.DegCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",DegInLst->ShrtName); } @@ -331,7 +332,8 @@ static void CrsCfg_Year (bool PutForm) Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == Gbl.Hierarchy.Crs.Year, // Selected? + Year == Gbl.Hierarchy.Crs.Year ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); diff --git a/swad_date.c b/swad_date.c index b26e506a..cb00c56c 100644 --- a/swad_date.c +++ b/swad_date.c @@ -767,7 +767,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Year <= LastYear; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Year); HTM_SELECT_End (); @@ -784,7 +784,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Month <= 12; Month++) HTM_OPTION (HTM_Type_UNSIGNED,&Month, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_MONTHS_SMALL[Month - 1]); HTM_SELECT_End (); @@ -801,7 +801,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Day <= 31; Day++) HTM_OPTION (HTM_Type_UNSIGNED,&Day, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Day); HTM_SELECT_End (); @@ -818,7 +818,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Hour <= 23; Hour++) HTM_OPTION (HTM_Type_UNSIGNED,&Hour, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u h",Hour); HTM_SELECT_End (); @@ -835,7 +835,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Minute < 60; Minute += MinutesIInterval[FormSeconds]) HTM_OPTION (HTM_Type_UNSIGNED,&Minute, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u ′",Minute); HTM_SELECT_End (); @@ -854,7 +854,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Second <= 59; Second++) HTM_OPTION (HTM_Type_UNSIGNED,&Second, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%02u ″",Second); HTM_SELECT_End (); @@ -1021,14 +1021,15 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Disabled ? " disabled=\"disabled\"" : ""); HTM_OPTION (HTM_Type_STRING,"0", - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "-"); for (Year = FirstYear; Year <= LastYear; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == DateSelected->Year, // Selected? + Year == DateSelected->Year ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Year); HTM_SELECT_End (); @@ -1044,14 +1045,15 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Disabled ? " disabled=\"disabled\"" : ""); HTM_OPTION (HTM_Type_STRING,"0", - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "-"); for (Month = 1; Month <= 12; Month++) HTM_OPTION (HTM_Type_UNSIGNED,&Month, - Month == DateSelected->Month, // Selected? + Month == DateSelected->Month ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_MONTHS_SMALL[Month - 1]); HTM_SELECT_End (); @@ -1069,7 +1071,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Disabled ? " disabled=\"disabled\"" : ""); HTM_OPTION (HTM_Type_STRING,"0", - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "-"); NumDaysSelectedMonth = (DateSelected->Month == 0) ? 31 : @@ -1079,7 +1081,8 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Day <= NumDaysSelectedMonth; Day++) HTM_OPTION (HTM_Type_UNSIGNED,&Day, - Day == DateSelected->Day, // Selected? + Day == DateSelected->Day ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Day); HTM_SELECT_End (); diff --git a/swad_degree.c b/swad_degree.c index 7d1eb719..d16ac0a0 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -240,7 +240,8 @@ void Deg_WriteSelectorOfDegree (void) " disabled=\"disabled\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Deg.DegCod <= 0, // Selected? + Gbl.Hierarchy.Deg.DegCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_Degree); @@ -264,7 +265,8 @@ void Deg_WriteSelectorOfDegree (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&DegCod, Gbl.Hierarchy.Deg.DegCod > 0 && - DegCod == Gbl.Hierarchy.Deg.DegCod, // Selected? + DegCod == Gbl.Hierarchy.Deg.DegCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); } @@ -416,7 +418,8 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) { DegTypInLst = &DegTypes->Lst[NumDegTyp]; HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, - DegTypInLst->DegTypCod == DegInLst->DegTypCod, // Selected? + DegTypInLst->DegTypCod == DegInLst->DegTypCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",DegTypInLst->DegTypName); } @@ -576,7 +579,8 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes) { DegTypInLst = &DegTypes->Lst[NumDegTyp]; HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, - DegTypInLst->DegTypCod == Deg_EditingDeg->DegTypCod, // Selected? + DegTypInLst->DegTypCod == Deg_EditingDeg->DegTypCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",DegTypInLst->DegTypName); } diff --git a/swad_degree_config.c b/swad_degree_config.c index ff85a69f..db24ff42 100644 --- a/swad_degree_config.c +++ b/swad_degree_config.c @@ -238,7 +238,8 @@ static void DegCfg_Center (bool PrintView,bool PutForm) { CtrInLst = &Gbl.Hierarchy.Ctrs.Lst[NumCtr]; HTM_OPTION (HTM_Type_LONG,&CtrInLst->CtrCod, - CtrInLst->CtrCod == Gbl.Hierarchy.Ctr.CtrCod, // Selected? + CtrInLst->CtrCod == Gbl.Hierarchy.Ctr.CtrCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CtrInLst->ShrtName); } diff --git a/swad_degree_type.c b/swad_degree_type.c index 54c6fcb6..7010d507 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -117,7 +117,8 @@ void DegTyp_WriteSelectorDegreeTypes (long SelectedDegTypCod) " class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - SelectedDegTypCod <= 0, // Selected? + SelectedDegTypCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Any_type_of_degree); for (NumDegTyp = 0; @@ -126,7 +127,8 @@ void DegTyp_WriteSelectorDegreeTypes (long SelectedDegTypCod) { DegTypInLst = &DegTypes.Lst[NumDegTyp]; HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, - DegTypInLst->DegTypCod == SelectedDegTypCod, // Selected? + DegTypInLst->DegTypCod == SelectedDegTypCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",DegTypInLst->DegTypName); } diff --git a/swad_department.c b/swad_department.c index 2effb8fa..e5a39ea5 100644 --- a/swad_department.c +++ b/swad_department.c @@ -511,7 +511,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm " class=\"HIE_SEL_NARROW INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - DptInLst->InsCod == 0, // Selected? + DptInLst->InsCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_institution); for (NumIns = 0; @@ -520,7 +521,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm { InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, - InsInLst->InsCod == DptInLst->InsCod, // Selected? + InsInLst->InsCod == DptInLst->InsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",InsInLst->ShrtName); } @@ -837,7 +839,8 @@ static void Dpt_PutFormToCreateDepartment (void) " class=\"HIE_SEL_NARROW INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - Dpt_EditingDpt->InsCod == 0, // Selected? + Dpt_EditingDpt->InsCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_institution); for (NumIns = 0; @@ -846,7 +849,8 @@ static void Dpt_PutFormToCreateDepartment (void) { InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, - InsInLst->InsCod == Dpt_EditingDpt->InsCod, // Selected? + InsInLst->InsCod == Dpt_EditingDpt->InsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",InsInLst->ShrtName); } @@ -1044,7 +1048,8 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, NoDptSelectable = true; HTM_OPTION (HTM_Type_STRING,"-1", - DptCod < 0, // Selected? + DptCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, NoDptSelectable ? HTM_OPTION_ENABLED : HTM_OPTION_DISABLED, "%s",TextWhenNoDptSelected); @@ -1052,7 +1057,8 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, /* Another department selected (different to all departments listed) */ HTM_OPTION (HTM_Type_STRING,"0", - DptCod == 0, // Selected? + DptCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_department); } @@ -1064,7 +1070,8 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, { DptInLst = &Departments.Lst[NumDpt]; HTM_OPTION (HTM_Type_LONG,&DptInLst->DptCod, - DptInLst->DptCod == DptCod, // Selected? + DptInLst->DptCod == DptCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",DptInLst->FullName); } diff --git a/swad_enrolment.c b/swad_enrolment.c index a7aec4b0..05d44ea9 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -680,7 +680,8 @@ void Enr_AskRemoveOldUsrs (void) Months <= Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS; Months++) HTM_OPTION (HTM_Type_UNSIGNED,&Months, - Months == Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS, // Selected? + Months == Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Months); HTM_SELECT_End (); diff --git a/swad_exam_print.c b/swad_exam_print.c index 1af2483b..6928207d 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -816,15 +816,18 @@ static void ExaPrn_WriteTF_AnsToFill (const struct ExaPrn_Print *Print, ExaPrn_WriteJSToUpdateExamPrint (Print,QstInd,Id,-1); HTM_Txt (" />"); HTM_OPTION (HTM_Type_STRING,"" , - Print->PrintedQuestions[QstInd].StrAnswers[0] == '\0',// Selected? + Print->PrintedQuestions[QstInd].StrAnswers[0] == '\0' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, " "); HTM_OPTION (HTM_Type_STRING,"T", - Print->PrintedQuestions[QstInd].StrAnswers[0] == 'T', // Selected? + Print->PrintedQuestions[QstInd].StrAnswers[0] == 'T' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_TF_QST[0]); HTM_OPTION (HTM_Type_STRING,"F", - Print->PrintedQuestions[QstInd].StrAnswers[0] == 'F', // Selected? + Print->PrintedQuestions[QstInd].StrAnswers[0] == 'F' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_TF_QST[1]); HTM_Txt (""); diff --git a/swad_figure.c b/swad_figure.c index 2b9c6a9f..01427c2c 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -124,7 +124,8 @@ static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType) { FigureTypeUnsigned = (unsigned) FigType; HTM_OPTION (HTM_Type_UNSIGNED,&FigureTypeUnsigned, - FigType == SelectedFigureType, // Selected? + FigType == SelectedFigureType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_FIGURE_TYPES[FigType]); } diff --git a/swad_group.c b/swad_group.c index 4597453b..19d950f9 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1254,11 +1254,13 @@ static void Grp_ListGroupTypesForEdition (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment, // Selected? + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_It_is_optional_to_choose_a_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment, // Selected? + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_It_is_mandatory_to_choose_a_group); HTM_SELECT_End (); @@ -1274,11 +1276,13 @@ static void Grp_ListGroupTypesForEdition (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment, // Selected? + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_A_student_can_only_belong_to_one_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment, // Selected? + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_A_student_can_belong_to_several_groups); HTM_SELECT_End (); @@ -1469,7 +1473,8 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) { GrpTyp2InLst = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp2]; HTM_OPTION (HTM_Type_LONG,&GrpTyp2InLst->GrpTypCod, - GrpTyp2InLst->GrpTypCod == GrpTyp1InLst->GrpTypCod, // Selected? + GrpTyp2InLst->GrpTypCod == GrpTyp1InLst->GrpTypCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",GrpTyp2InLst->GrpTypName); } @@ -1502,13 +1507,15 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) /* Option for no assigned room */ HTM_OPTION (HTM_Type_STRING,"-1", - Grp->Room.RooCod < 0, // Selected? + Grp->Room.RooCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_No_assigned_room); /* Option for another room */ HTM_OPTION (HTM_Type_STRING,"0", - Grp->Room.RooCod == 0, // Selected? + Grp->Room.RooCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_room); @@ -1519,7 +1526,8 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) { RooInLst = &Rooms->Lst[NumRoo]; HTM_OPTION (HTM_Type_LONG,&RooInLst->RooCod, - RooInLst->RooCod == Grp->Room.RooCod, // Selected? + RooInLst->RooCod == Grp->Room.RooCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",RooInLst->ShrtName); } @@ -2414,11 +2422,13 @@ static void Grp_PutFormToCreateGroupType (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment, // Selected? + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_It_is_optional_to_choose_a_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment, // Selected? + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_It_is_mandatory_to_choose_a_group); HTM_SELECT_End (); @@ -2431,11 +2441,13 @@ static void Grp_PutFormToCreateGroupType (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTyp.MultipleEnrolment, // Selected? + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment ? HTM_OPTION_UNSELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_A_student_can_only_belong_to_one_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTyp.MultipleEnrolment, // Selected? + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_A_student_can_belong_to_several_groups); HTM_SELECT_End (); @@ -2543,7 +2555,8 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) { GrpTypInLst = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; HTM_OPTION (HTM_Type_LONG,&GrpTypInLst->GrpTypCod, - GrpTypInLst->GrpTypCod == Gbl.Crs.Grps.GrpTyp.GrpTypCod, // Selected? + GrpTypInLst->GrpTypCod == Gbl.Crs.Grps.GrpTyp.GrpTypCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",GrpTypInLst->GrpTypName); } @@ -2571,13 +2584,15 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) /* Option for no assigned room */ HTM_OPTION (HTM_Type_STRING,"-1", - Gbl.Crs.Grps.RooCod < 0, // Selected? + Gbl.Crs.Grps.RooCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_No_assigned_room); /* Option for another room */ HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Crs.Grps.RooCod == 0, // Selected? + Gbl.Crs.Grps.RooCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_room); @@ -2588,7 +2603,8 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) { RooInLst = &Rooms->Lst[NumRoo]; HTM_OPTION (HTM_Type_LONG,&RooInLst->RooCod, - RooInLst->RooCod == Gbl.Crs.Grps.RooCod, // Selected? + RooInLst->RooCod == Gbl.Crs.Grps.RooCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",RooInLst->ShrtName); } diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 93d973ba..57ce31f3 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -837,13 +837,13 @@ void Hie_WriteStatusCellEditable (bool ICanEdit,Hie_Status_t Status, StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_PENDING); HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned, - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt[Hie_STATUS_PENDING]); StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_ACTIVE); HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned, - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt[Hie_STATUS_ACTIVE]); diff --git a/swad_holiday.c b/swad_holiday.c index aa1d5e73..e0084b8e 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -542,7 +542,8 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, "name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - HldInLst->PlcCod <= 0, // Selected? + HldInLst->PlcCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_All_places); for (NumPlc = 0; @@ -551,7 +552,8 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, { PlcInLst = &Places->Lst[NumPlc]; HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, - PlcInLst->PlcCod == HldInLst->PlcCod, // Selected? + PlcInLst->PlcCod == HldInLst->PlcCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",PlcInLst->ShrtName); } @@ -573,7 +575,8 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, { HolidayTypeUnsigned = (unsigned) HolidayType; HTM_OPTION (HTM_Type_UNSIGNED,&HolidayTypeUnsigned, - HolidayType == HldInLst->HldTyp, // Selected? + HolidayType == HldInLst->HldTyp ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_HOLIDAY_TYPES[HolidayType]); } @@ -914,7 +917,8 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) "name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - Hld_EditingHld->PlcCod <= 0, // Selected? + Hld_EditingHld->PlcCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_All_places); for (NumPlc = 0; @@ -923,7 +927,8 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) { PlcInLst = &Places->Lst[NumPlc]; HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, - PlcInLst->PlcCod == Hld_EditingHld->PlcCod, // Selected? + PlcInLst->PlcCod == Hld_EditingHld->PlcCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",PlcInLst->ShrtName); } @@ -942,7 +947,8 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) { HolidayTypeUnsigned = (unsigned) HolidayType; HTM_OPTION (HTM_Type_UNSIGNED,&HolidayTypeUnsigned, - HolidayType == Hld_EditingHld->HldTyp, // Selected? + HolidayType == Hld_EditingHld->HldTyp ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_HOLIDAY_TYPES[HolidayType]); } diff --git a/swad_institution.c b/swad_institution.c index 5792b6c3..11778a4f 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -846,7 +846,8 @@ void Ins_WriteSelectorOfInstitution (void) The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Ins.InsCod < 0, // Selected? + Gbl.Hierarchy.Ins.InsCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_Institution); @@ -870,7 +871,8 @@ void Ins_WriteSelectorOfInstitution (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&InsCod, Gbl.Hierarchy.Ins.InsCod > 0 && - InsCod == Gbl.Hierarchy.Ins.InsCod, // Selected? + InsCod == Gbl.Hierarchy.Ins.InsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); } diff --git a/swad_institution_config.c b/swad_institution_config.c index fc59d29d..702c6d95 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -338,7 +338,8 @@ static void InsCfg_Country (bool PrintView,bool PutForm) { CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, - CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod, // Selected? + CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CtyInLst->Name[Gbl.Prefs.Language]); } diff --git a/swad_language.c b/swad_language.c index e48fe02c..948b0131 100644 --- a/swad_language.c +++ b/swad_language.c @@ -137,7 +137,8 @@ void Lan_PutSelectorToSelectLanguage (void) { LanUnsigned = (unsigned) Lan; HTM_OPTION (HTM_Type_UNSIGNED,&LanUnsigned, - Lan == Gbl.Prefs.Language, // Selected? + Lan == Gbl.Prefs.Language ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STR_LANG_NAME[Lan]); } diff --git a/swad_message.c b/swad_message.c index 9fa832ee..c2a6003e 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1820,7 +1820,8 @@ static void Msg_ShowFormSelectCourseSentOrRecMsgs (const struct Msg_Messages *Me /* Write a first option to select any course */ HTM_OPTION (HTM_Type_STRING,"", - Messages->FilterCrsCod < 0, // Selected? + Messages->FilterCrsCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_any_course); @@ -1834,7 +1835,8 @@ static void Msg_ShowFormSelectCourseSentOrRecMsgs (const struct Msg_Messages *Me if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0) HTM_OPTION (HTM_Type_LONG,&CrsCod, - CrsCod == Messages->FilterCrsCod, // Selected? + CrsCod == Messages->FilterCrsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); // Course short name } diff --git a/swad_photo.c b/swad_photo.c index 53d21e23..0dfb9d5a 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1802,7 +1802,8 @@ static void Pho_PutSelectorForTypeOfAvg (const struct Pho_DegPhotos *DegPhotos) { TypeOfAvgUnsigned = (unsigned) TypeOfAvg; HTM_OPTION (HTM_Type_UNSIGNED,&TypeOfAvgUnsigned, - TypeOfAvg == DegPhotos->TypeOfAverage, // Selected? + TypeOfAvg == DegPhotos->TypeOfAverage ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_AVERAGE_PHOTO_TYPES[TypeOfAvg]); } @@ -1868,7 +1869,8 @@ static void Pho_PutSelectorForHowComputePhotoSize (const struct Pho_DegPhotos *D { PhoSiUnsigned = (unsigned) PhoSi; HTM_OPTION (HTM_Type_UNSIGNED,&PhoSiUnsigned, - PhoSi == DegPhotos->HowComputePhotoSize, // Selected? + PhoSi == DegPhotos->HowComputePhotoSize ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_DEGREE_PHOTO_SIZE[PhoSi]); } @@ -1933,7 +1935,8 @@ static void Pho_PutSelectorForHowOrderDegrees (const struct Pho_DegPhotos *DegPh { OrderUnsigned = (unsigned) Order; HTM_OPTION (HTM_Type_UNSIGNED,&OrderUnsigned, - Order == DegPhotos->HowOrderDegrees, // Selected? + Order == DegPhotos->HowOrderDegrees ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_DEGREE_PHOTO_ORDER[Order]); } @@ -1998,8 +2001,8 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh struct Deg_Degree Deg; long EstimatedTimeToComputeAvgPhotoInMicroseconds; char StrEstimatedTimeToComputeAvgPhoto[Dat_MAX_BYTES_TIME + 1]; - bool Selected; - bool Disabled; + HTM_OptionSelected_t Selected; + HTM_OptionDisabled_t Disabled; if ((Deg.DegCod = Pho_GetDegWithAvgPhotoLeastRecentlyUpdated ()) > 0) { @@ -2043,8 +2046,9 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh Dat_WriteTime (StrEstimatedTimeToComputeAvgPhoto, EstimatedTimeToComputeAvgPhotoInMicroseconds); - Selected = (Degs.Lst[NumDeg].DegCod == Deg.DegCod); - if (Selected) + Selected = (Degs.Lst[NumDeg].DegCod == Deg.DegCod) ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED; + if (Selected == HTM_OPTION_SELECTED) Disabled = HTM_OPTION_ENABLED; else // Too recently computed ? diff --git a/swad_project.c b/swad_project.c index fe8e7417..1d9d02d8 100644 --- a/swad_project.c +++ b/swad_project.c @@ -1833,7 +1833,8 @@ static void Prj_PutSelectorReviewStatus (struct Prj_Projects *Projects) { ReviewStatusUnsigned = (unsigned) ReviewStatus; HTM_OPTION (HTM_Type_UNSIGNED,&ReviewStatusUnsigned, - ReviewStatus == Projects->Prj.Review.Status, // Selected? + ReviewStatus == Projects->Prj.Review.Status ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_PROJECT_REVIEW_SINGUL[ReviewStatus]); } @@ -3813,11 +3814,13 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects, "name=\"Assigned\" class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"Y", - Projects->Prj.Assigned == Prj_ASSIGNED, // Selected? + Projects->Prj.Assigned == Prj_ASSIGNED ? HTM_OPTION_SELECTED : + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_Yes); HTM_OPTION (HTM_Type_STRING,"N", - Projects->Prj.Assigned == Prj_NONASSIG, // Selected? + Projects->Prj.Assigned == Prj_NONASSIG ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_No); HTM_SELECT_End (); @@ -3859,7 +3862,8 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects, { ProposalUnsigned = (unsigned) Proposal; HTM_OPTION (HTM_Type_UNSIGNED,&ProposalUnsigned, - Projects->Prj.Proposal == Proposal, // Selected? + Projects->Prj.Proposal == Proposal ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_PROJECT_STATUS[Proposal]); } diff --git a/swad_project_config.c b/swad_project_config.c index a56420bd..b154bedb 100644 --- a/swad_project_config.c +++ b/swad_project_config.c @@ -205,7 +205,7 @@ static void PrjCfg_ShowFormsRubricsOfType (const struct Rub_Rubrics *Rubrics, Par_CodeStr[ParCod_Rub]); /* First option to indicate that no rubric is selected */ HTM_OPTION (HTM_Type_STRING,"-1", - false, // Selected? + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "[%s]",Txt_no_rubric); @@ -216,7 +216,8 @@ static void PrjCfg_ShowFormsRubricsOfType (const struct Rub_Rubrics *Rubrics, { Rub_DB_GetRubricTitle (Rubrics->Lst[NumRubThisCrs],Title,Rub_MAX_BYTES_TITLE); HTM_OPTION (HTM_Type_LONG,&Rubrics->Lst[NumRubThisCrs], - Rubrics->Lst[NumRubThisCrs] == RubCodThisType, // Selected? + Rubrics->Lst[NumRubThisCrs] == RubCodThisType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Title); } @@ -235,7 +236,7 @@ static void PrjCfg_ShowFormsRubricsOfType (const struct Rub_Rubrics *Rubrics, /* First option to indicate that no rubric is selected */ HTM_OPTION (HTM_Type_STRING,"-1", - true, // Selected? + HTM_OPTION_SELECTED, HTM_OPTION_DISABLED, "[%s]",Txt_add_rubric); @@ -246,7 +247,7 @@ static void PrjCfg_ShowFormsRubricsOfType (const struct Rub_Rubrics *Rubrics, { Rub_DB_GetRubricTitle (Rubrics->Lst[NumRubThisCrs],Title,Rub_MAX_BYTES_TITLE); HTM_OPTION (HTM_Type_LONG,&Rubrics->Lst[NumRubThisCrs], - false, // Selected? + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Title); } diff --git a/swad_question.c b/swad_question.c index 56c51c6e..ce8015de 100644 --- a/swad_question.c +++ b/swad_question.c @@ -1884,7 +1884,7 @@ void Qst_PutFormEditOneQst (struct Qst_Question *Question) The_GetSuffix ()); free (FuncOnChange); HTM_OPTION (HTM_Type_STRING,"", - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, " "); mysql_data_seek (mysql_res,0); @@ -1902,23 +1902,23 @@ void Qst_PutFormEditOneQst (struct Qst_Question *Question) IsThisTag = false; if (!strcasecmp (Question->Tags.Txt[IndTag],row[1])) { - HTM_Txt (" selected=\"selected\""); IsThisTag = true; TagFound = true; } HTM_OPTION (HTM_Type_STRING,row[1], - IsThisTag, // Selected? + IsThisTag ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",row[1]); } /* If it's a new tag received from the form */ if (!TagFound && Question->Tags.Txt[IndTag][0]) HTM_OPTION (HTM_Type_STRING,Question->Tags.Txt[IndTag], - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Question->Tags.Txt[IndTag]); HTM_OPTION (HTM_Type_STRING,"", - false, // Selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "[%s]",Txt_new_tag); HTM_SELECT_End (); diff --git a/swad_record.c b/swad_record.c index cc8ba432..ca2b3903 100644 --- a/swad_record.c +++ b/swad_record.c @@ -332,7 +332,8 @@ static void Rec_ListFieldsRecordsForEdition (void) { VisUnsigned = (unsigned) Vis; HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned, - Vis == FldInLst->Visibility, // Selected? + Vis == FldInLst->Visibility ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } @@ -403,7 +404,8 @@ void Rec_ShowFormCreateRecordField (void) { VisUnsigned = (unsigned) Vis; HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned, - Vis == Gbl.Crs.Records.Field.Visibility, // Selected? + Vis == Gbl.Crs.Records.Field.Visibility ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } @@ -1408,7 +1410,8 @@ static void Rec_ShowLinkToPrintPreviewOfRecords (void) i <= Rec_MAX_RECORDS_PER_PAGE; i++) HTM_OPTION (HTM_Type_UNSIGNED,&i, - i == Gbl.Usrs.Listing.RecsPerPag, // Selected? + i == Gbl.Usrs.Listing.RecsPerPag ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",i); HTM_SELECT_End (); @@ -2791,7 +2794,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm, // Selected? + Role == DefaultRoleInForm ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); } @@ -2858,7 +2862,7 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, case Rol_NET: RoleUnsigned = (unsigned) Gbl.Usrs.Me.Role.Logged; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_DISABLED, "%s",Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][UsrDat->Sex]); break; @@ -2873,7 +2877,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm, // Selected? + Role == DefaultRoleInForm ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); } @@ -2898,7 +2903,7 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, The_GetSuffix ()); RoleUnsigned = (unsigned) DefaultRoleInForm; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_DISABLED, "%s",Txt_ROLES_SINGUL_Abc[DefaultRoleInForm][UsrDat->Sex]); HTM_SELECT_End (); @@ -2941,7 +2946,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm, // Selected? + Role == DefaultRoleInForm ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]); } @@ -2961,7 +2967,7 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, The_GetSuffix ()); RoleUnsigned = (unsigned) Rol_GST; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - true, // Selected + HTM_OPTION_SELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLES_SINGUL_Abc[Rol_GST][Usr_SEX_UNKNOWN]); HTM_SELECT_End (); @@ -3177,11 +3183,12 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm) " required=\"required\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - false, // Not selected + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Country); HTM_OPTION (HTM_Type_STRING,"0", - UsrDat->CtyCod == 0, // Selected? + UsrDat->CtyCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_country); for (NumCty = 0; @@ -3190,7 +3197,8 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm) { CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, - CtyInLst->CtyCod == UsrDat->CtyCod, // Selected? + CtyInLst->CtyCod == UsrDat->CtyCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CtyInLst->Name[Gbl.Prefs.Language]); } @@ -3810,7 +3818,8 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) " class=\"REC_C2_BOT_INPUT INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0, // Selected? + Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, NULL); for (NumCty = 0; @@ -3819,7 +3828,8 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) { CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, - CtyInLst->CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod, // Selected? + CtyInLst->CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",CtyInLst->Name[Gbl.Prefs.Language]); } @@ -3854,11 +3864,13 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) " class=\"REC_C2_BOT_INPUT INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - Gbl.Usrs.Me.UsrDat.InsCod < 0, // Selected? + Gbl.Usrs.Me.UsrDat.InsCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, NULL); HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Usrs.Me.UsrDat.InsCod == 0, // Selected? + Gbl.Usrs.Me.UsrDat.InsCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_institution); for (NumIns = 0; @@ -3867,7 +3879,8 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) { InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, - InsInLst->InsCod == Gbl.Usrs.Me.UsrDat.InsCod, // Selected? + InsInLst->InsCod == Gbl.Usrs.Me.UsrDat.InsCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",InsInLst->FullName); } @@ -3903,11 +3916,13 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) " class=\"REC_C2_BOT_INPUT INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0, // Selected? + Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_DISABLED, NULL); HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0, // Selected? + Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, Txt_Another_center); for (NumCtr = 0; @@ -3916,7 +3931,8 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) { CtrInLst = &Gbl.Hierarchy.Ctrs.Lst[NumCtr]; HTM_OPTION (HTM_Type_LONG,&CtrInLst->CtrCod, - CtrInLst->CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod, // Selected? + CtrInLst->CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, CtrInLst->FullName); } diff --git a/swad_role.c b/swad_role.c index 4e8a0f89..0ee8c565 100644 --- a/swad_role.c +++ b/swad_role.c @@ -492,7 +492,8 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect) { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == Gbl.Usrs.Me.Role.Logged, // Selected? + Role == Gbl.Usrs.Me.Role.Logged ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]); } diff --git a/swad_room.c b/swad_room.c index f3c5bffa..d6bc2648 100644 --- a/swad_room.c +++ b/swad_room.c @@ -771,13 +771,15 @@ static void Roo_PutSelectorBuilding (long BldCod, /***** Option for no assigned building *****/ HTM_OPTION (HTM_Type_STRING,"-1", - BldCod < 0, // Selected? + BldCod < 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_No_assigned_building); /***** Option for another room *****/ HTM_OPTION (HTM_Type_STRING,"0", - BldCod == 0, // Selected? + BldCod == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Another_building); @@ -788,7 +790,8 @@ static void Roo_PutSelectorBuilding (long BldCod, { BldInLst = &Buildings->Lst[NumBld]; HTM_OPTION (HTM_Type_LONG,&BldInLst->BldCod, - BldCod == BldInLst->BldCod, // Selected? + BldCod == BldInLst->BldCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",BldInLst->ShrtName); } @@ -817,7 +820,8 @@ static void Roo_PutSelectorType (Roo_RoomType_t RoomType, Type <= (Roo_RoomType_t) (Roo_NUM_TYPES - 1); Type++) HTM_OPTION (HTM_Type_UNSIGNED,&Type, - Type == RoomType, // Selected? + Type == RoomType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROOM_TYPES[Type]); diff --git a/swad_scope.c b/swad_scope.c index fb96d055..c1be278b 100644 --- a/swad_scope.c +++ b/swad_scope.c @@ -55,12 +55,30 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan HieLvl_Level_t Scope; unsigned ScopeUnsigned; bool WriteScope; + static const char **TxtScope[HieLvl_NUM_LEVELS] = + { + [HieLvl_SYS] = &Txt_System, + [HieLvl_CTY] = &Txt_Country, + [HieLvl_INS] = &Txt_Institution, + [HieLvl_CTR] = &Txt_Center, + [HieLvl_DEG] = &Txt_Degree, + [HieLvl_CRS] = &Txt_Course, + }; + const char *TxtName[HieLvl_NUM_LEVELS] = + { + [HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME, + [HieLvl_CTY] = Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], + [HieLvl_INS] = Gbl.Hierarchy.Ins.ShrtName, + [HieLvl_CTR] = Gbl.Hierarchy.Ctr.ShrtName, + [HieLvl_DEG] = Gbl.Hierarchy.Deg.ShrtName, + [HieLvl_CRS] = Gbl.Hierarchy.Crs.ShrtName, + }; HTM_SELECT_Begin (SubmitOnChange,NULL, "id=\"%s\" name=\"%s\" class=\"INPUT_%s\"", ParName,ParName,The_GetSuffix ()); - for (Scope = (HieLvl_Level_t) 0; + for (Scope = (HieLvl_Level_t) 1; Scope <= (HieLvl_Level_t) (HieLvl_NUM_LEVELS - 1); Scope++) if ((Gbl.Scope.Allowed & (1 << Scope))) @@ -93,7 +111,6 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan WriteScope = true; break; default: - Err_WrongScopeExit (); break; } @@ -101,60 +118,12 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan { /***** Write allowed option *****/ ScopeUnsigned = (unsigned) Scope; - switch (Scope) - { - case HieLvl_SYS: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_System, - Cfg_PLATFORM_SHORT_NAME); - break; - case HieLvl_CTY: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_Country, - Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); - break; - case HieLvl_INS: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_Institution, - Gbl.Hierarchy.Ins.ShrtName); - break; - case HieLvl_CTR: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_Center, - Gbl.Hierarchy.Ctr.ShrtName); - break; - case HieLvl_DEG: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_Degree, - Gbl.Hierarchy.Deg.ShrtName); - break; - case HieLvl_CRS: - HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope, // Selected? - HTM_OPTION_ENABLED, - "%s: %s", - Txt_Course, - Gbl.Hierarchy.Crs.ShrtName); - break; - default: - Err_WrongScopeExit (); - break; - } + HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, + Scope == Gbl.Scope.Current ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, + HTM_OPTION_ENABLED, + "%s: %s", + *TxtScope[Scope],TxtName[Scope]); } } diff --git a/swad_search.c b/swad_search.c index 07a72677..68e15498 100644 --- a/swad_search.c +++ b/swad_search.c @@ -200,7 +200,8 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (HieLvl_Level_t DefaultS { WTS = (unsigned) WhatToSearch; HTM_OPTION (HTM_Type_UNSIGNED,&WTS, - WhatToSearch == Search->WhatToSearch, // Selected? + WhatToSearch == Search->WhatToSearch ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",*Titles[WhatToSearch]); } diff --git a/swad_statistic.c b/swad_statistic.c index c8935f1b..9dc4ecb8 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -370,7 +370,8 @@ static void Sta_PutFormCrsHits (struct Sta_Stats *Stats) { ClicksGroupedByUnsigned = (unsigned) ClicksGroupedBy; HTM_OPTION (HTM_Type_UNSIGNED,&ClicksGroupedByUnsigned, - ClicksGroupedBy == Stats->ClicksGroupedBy, // Selected? + ClicksGroupedBy == Stats->ClicksGroupedBy ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } @@ -407,7 +408,8 @@ static void Sta_PutFormCrsHits (struct Sta_Stats *Stats) i < NUM_OPTIONS_ROWS_PER_PAGE; i++) HTM_OPTION (HTM_Type_UNSIGNED,&RowsPerPage[i], - RowsPerPage[i] == Stats->RowsPerPage, // Selected? + RowsPerPage[i] == Stats->RowsPerPage ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",RowsPerPage[i]); HTM_SELECT_End (); @@ -519,7 +521,8 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats) { RoleStatUnsigned = (unsigned) RoleStat; HTM_OPTION (HTM_Type_UNSIGNED,&RoleStatUnsigned, - RoleStat == Stats->Role, // Selected? + RoleStat == Stats->Role ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_ROLE_STATS[RoleStat]); } @@ -580,7 +583,8 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats) { ClicksGroupedByUnsigned = (unsigned) ClicksGroupedBy; HTM_OPTION (HTM_Type_UNSIGNED,&ClicksGroupedByUnsigned, - ClicksGroupedBy == Stats->ClicksGroupedBy, // Selected? + ClicksGroupedBy == Stats->ClicksGroupedBy ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } @@ -661,7 +665,8 @@ static void Sta_WriteSelectorCountType (const struct Sta_Stats *Stats) { StatCountTypeUnsigned = (unsigned) StatCountType; HTM_OPTION (HTM_Type_UNSIGNED,&StatCountTypeUnsigned, - StatCountType == Stats->CountType, // Selected? + StatCountType == Stats->CountType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_TYPE_COUNT_SMALL[StatCountType]); } @@ -693,7 +698,8 @@ static void Sta_WriteSelectorAction (const struct Sta_Stats *Stats) " class=\"STAT_SEL INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - Stats->NumAction == 0, // Selected? + Stats->NumAction == 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_Any_action); for (Action = (Act_Action_t) 1; @@ -703,7 +709,8 @@ static void Sta_WriteSelectorAction (const struct Sta_Stats *Stats) Tab = Act_GetTab (Act_GetSuperAction (Action)); ActionUnsigned = (unsigned) Action; HTM_OPTION (HTM_Type_UNSIGNED,&ActionUnsigned, - Action == Stats->NumAction, // Selected? + Action == Stats->NumAction ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u: %s > %s", (unsigned) Action,Txt_TABS_TXT[Tab],Act_GetActionText (Action)); @@ -1620,7 +1627,8 @@ static void Sta_ShowDistrAccessesPerDayAndHour (const struct Sta_Stats *Stats, { ColorTypeUnsigned = (unsigned) ColorType; HTM_OPTION (HTM_Type_UNSIGNED,&ColorTypeUnsigned, - ColorType == SelectedColorType, // Selected? + ColorType == SelectedColorType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_STAT_COLOR_TYPES[ColorType]); } diff --git a/swad_test_print.c b/swad_test_print.c index ab0be2ac..adbede8f 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -398,15 +398,18 @@ static void TstPrn_WriteTF_AnsToFill (const struct TstPrn_PrintedQuestion *Print "name=\"Ans%010u\" class=\"INPUT_%s\"", QstInd,The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"" , - PrintedQuestion->StrAnswers[0] == '\0', // Selected? + PrintedQuestion->StrAnswers[0] == '\0' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, " "); HTM_OPTION (HTM_Type_STRING,"T", - PrintedQuestion->StrAnswers[0] == 'T', // Selected? + PrintedQuestion->StrAnswers[0] == 'T' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_TF_QST[0]); HTM_OPTION (HTM_Type_STRING,"F", - PrintedQuestion->StrAnswers[0] == 'F', // Selected? + PrintedQuestion->StrAnswers[0] == 'F' ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_TF_QST[1]); HTM_SELECT_End (); diff --git a/swad_timetable.c b/swad_timetable.c index d1d14f8b..58a4aa57 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1526,7 +1526,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, ((Timetable->View == Tmt_CRS_EDIT) && (CT == Tmt_LECTURE || CT == Tmt_PRACTICAL)) || ((Timetable->View == Tmt_TUT_EDIT) && (CT == Tmt_TUTORING))) HTM_OPTION (HTM_Type_STRING,Tmt_DB_ClassType[CT], - CT == ClassType, // Selected? + CT == ClassType ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_TIMETABLE_CLASS_TYPES[CT]); HTM_SELECT_End (); @@ -1574,7 +1575,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, Timetable->Config.Range.MinutesPerInterval) < 0) // Minutes Err_NotEnoughMemoryExit (); HTM_OPTION (HTM_Type_STRING,TTDur, - Dur == DurationNumIntervals, // Selected? + Dur == DurationNumIntervals ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",TTDur); free (TTDur); @@ -1601,7 +1603,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, CellStr,Par_CodeStr[ParCod_Grp], The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - GrpCod <= 0, // Selected? + GrpCod <= 0 ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s",Txt_All_groups); for (NumGrpTyp = 0; @@ -1626,7 +1629,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, Err_NotEnoughMemoryExit (); } HTM_OPTION (HTM_Type_LONG,&Grp->GrpCod, - GrpCod == Grp->GrpCod, // Selected? + GrpCod == Grp->GrpCod ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%s %s%s", GrpTyp->GrpTypName,Grp->GrpName,Room); diff --git a/swad_user.c b/swad_user.c index 22aeeeb4..8c96e974 100644 --- a/swad_user.c +++ b/swad_user.c @@ -6227,7 +6227,8 @@ void Usr_PutSelectorNumColsClassPhoto (void) Cols <= Usr_CLASS_PHOTO_COLS_MAX; Cols++) HTM_OPTION (HTM_Type_UNSIGNED,&Cols, - Cols == Gbl.Usrs.ClassPhoto.Cols, // Selected? + Cols == Gbl.Usrs.ClassPhoto.Cols ? HTM_OPTION_SELECTED : + HTM_OPTION_UNSELECTED, HTM_OPTION_ENABLED, "%u",Cols);