diff --git a/sql/swad.sql b/sql/swad.sql index bb7f26ef..0acc2bf1 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1206,7 +1206,10 @@ CREATE TABLE IF NOT EXISTS prg_resources ( -- CREATE TABLE IF NOT EXISTS prj_config ( CrsCod INT NOT NULL DEFAULT -1, - Editable ENUM('N','Y') NOT NULL DEFAULT 'Y', + RubTutCod INT NOT NULL DEFAULT -1, + RubEvlCod INT NOT NULL DEFAULT -1, + RubGblCod INT NOT NULL DEFAULT -1, + NETCanCreate ENUM('N','Y') NOT NULL DEFAULT 'Y', UNIQUE INDEX(CrsCod)); -- -- Table prj_projects: stores the projects proposed by the teachers to their students diff --git a/swad_attendance.c b/swad_attendance.c index 7967823e..4d1d9d95 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1064,9 +1064,13 @@ void Att_ReqCreatOrEditEvent (void) "id=\"ComTchVisible\" name=\"ComTchVisible\"" " class=\"INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"N",!Events.Event.CommentTchVisible,false, + HTM_OPTION (HTM_Type_STRING,"N", + !Events.Event.CommentTchVisible, // Selected? + false, // Not disabled "%s",Txt_Hidden_MALE_PLURAL); - HTM_OPTION (HTM_Type_STRING,"Y", Events.Event.CommentTchVisible,false, + HTM_OPTION (HTM_Type_STRING,"Y", + Events.Event.CommentTchVisible, // Selected? + false, // Not disabled "%s",Txt_Visible_MALE_PLURAL); HTM_SELECT_End (); HTM_TD_End (); diff --git a/swad_browser.c b/swad_browser.c index e263c56a..f99c61ec 100644 --- a/swad_browser.c +++ b/swad_browser.c @@ -7692,10 +7692,12 @@ 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,false, + !FileMetadata.IsPublic, // Selected? + false, // Not disabled "%s",Txt_Private_available_to_certain_users_identified); HTM_OPTION (HTM_Type_STRING,"Y", - FileMetadata.IsPublic,false, + FileMetadata.IsPublic, // Selected? + false, // Not disabled "%s",Txt_Public_open_educational_resource_OER_for_everyone); HTM_SELECT_End (); } @@ -7727,7 +7729,8 @@ void Brw_ShowFileMetadata (void) { LicenseUnsigned = (unsigned) License; HTM_OPTION (HTM_Type_UNSIGNED,&LicenseUnsigned, - License == FileMetadata.License,false, + License == FileMetadata.License, // Selected? + false, // Not disabled "%s",Txt_LICENSES[License]); } HTM_SELECT_End (); @@ -9752,7 +9755,8 @@ void Brw_AskRemoveOldFiles (void) Months <= Brw_MAX_MONTHS_IN_BRIEFCASE; Months++) HTM_OPTION (HTM_Type_UNSIGNED,&Months, - Months == Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES,false, + Months == Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES, // Selected? + false, // Not disabled "%u",Months); HTM_SELECT_End (); HTM_NBSP (); diff --git a/swad_call_for_exam.c b/swad_call_for_exam.c index 769fcdd4..de88f9c2 100644 --- a/swad_call_for_exam.c +++ b/swad_call_for_exam.c @@ -1054,7 +1054,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - CallsForExams->CallForExam.Year == Year,false, + Year == CallsForExams->CallForExam.Year, // Selected + false, // Not disabled "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); } @@ -1138,13 +1139,15 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, " class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"0", - CallsForExams->CallForExam.StartTime.Hour == 0,false, + CallsForExams->CallForExam.StartTime.Hour == 0, // Selected? + false, // Not disabled "-"); for (Hour = 7; Hour <= 22; Hour++) HTM_OPTION (HTM_Type_UNSIGNED,&Hour, - CallsForExams->CallForExam.StartTime.Hour == Hour,false, + Hour == CallsForExams->CallForExam.StartTime.Hour, // Selected? + false, // Not disabled "%02u %s",Hour,Txt_hours_ABBREVIATION); HTM_SELECT_End (); @@ -1155,7 +1158,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Minute <= 59; Minute++) HTM_OPTION (HTM_Type_UNSIGNED,&Minute, - CallsForExams->CallForExam.StartTime.Minute == Minute,false, + Minute == CallsForExams->CallForExam.StartTime.Minute, // Selected? + false, // Not disabled "%02u ′",Minute); HTM_SELECT_End (); } @@ -1188,7 +1192,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Hour <= 8; Hour++) HTM_OPTION (HTM_Type_UNSIGNED,&Hour, - CallsForExams->CallForExam.Duration.Hour == Hour,false, + Hour == CallsForExams->CallForExam.Duration.Hour, // Selected? + false, // Not disabled "%02u %s",Hour,Txt_hours_ABBREVIATION); HTM_SELECT_End (); @@ -1200,7 +1205,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams, Minute <= 59; Minute++) HTM_OPTION (HTM_Type_UNSIGNED,&Minute, - CallsForExams->CallForExam.Duration.Minute == Minute,false, + Minute == CallsForExams->CallForExam.Duration.Minute, // Selected? + false, // Not disabled "%02u ′",Minute); HTM_SELECT_End (); } diff --git a/swad_center.c b/swad_center.c index 9e07cfbf..a940e66b 100644 --- a/swad_center.c +++ b/swad_center.c @@ -343,10 +343,6 @@ static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr) const char *TxtClassStrong; const char *BgColor; - /***** Get data of place of this center *****/ - Plc.PlcCod = Ctr->PlcCod; - Plc_GetPlaceDataByCod (&Plc); - if (Ctr->Status & Hie_STATUS_BIT_PENDING) { TxtClassNormal = @@ -383,6 +379,8 @@ static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr) /***** Place *****/ HTM_TD_Begin ("class=\"LM %s_%s %s\"", TxtClassNormal,The_GetSuffix (),BgColor); + Plc.PlcCod = Ctr->PlcCod; + Plc_GetPlaceDataByCod (&Plc); HTM_Txt (Plc.ShrtName); HTM_TD_End (); @@ -706,7 +704,8 @@ void Ctr_WriteSelectorOfCenter (void) " disabled=\"disabled\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Ctr.CtrCod < 0,true, + Gbl.Hierarchy.Ctr.CtrCod < 0, // Selected? + true, // Disabled "[%s]",Txt_Center); if (Gbl.Hierarchy.Ins.InsCod > 0) @@ -727,7 +726,8 @@ void Ctr_WriteSelectorOfCenter (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&CtrCod, Gbl.Hierarchy.Ctr.CtrCod > 0 && - CtrCod == Gbl.Hierarchy.Ctr.CtrCod,false, + CtrCod == Gbl.Hierarchy.Ctr.CtrCod, // Selected? + false, // Not disabled "%s",row[1]); } @@ -753,6 +753,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places) unsigned NumCtr; struct Ctr_Center *Ctr; unsigned NumPlc; + const struct Plc_Place *PlcInLst; char WWW[Cns_MAX_BYTES_WWW + 1]; struct Usr_Data UsrDat; bool ICanEdit; @@ -824,9 +825,13 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places) for (NumPlc = 0; NumPlc < Places->Num; NumPlc++) - HTM_OPTION (HTM_Type_LONG,&Places->Lst[NumPlc].PlcCod, - Places->Lst[NumPlc].PlcCod == Ctr->PlcCod,false, - "%s",Places->Lst[NumPlc].ShrtName); + { + PlcInLst = &Places->Lst[NumPlc]; + HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, + PlcInLst->PlcCod == Ctr->PlcCod, // Selected? + false, // Not disabled + "%s",PlcInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); } @@ -1268,6 +1273,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places) extern const char *Txt_Another_place; extern const char *Txt_Create_center; unsigned NumPlc; + const struct Plc_Place *PlcInLst; /***** Begin form *****/ if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) @@ -1311,9 +1317,13 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places) for (NumPlc = 0; NumPlc < Places->Num; NumPlc++) - HTM_OPTION (HTM_Type_LONG,&Places->Lst[NumPlc].PlcCod, - Places->Lst[NumPlc].PlcCod == Ctr_EditingCtr->PlcCod,false, - "%s",Places->Lst[NumPlc].ShrtName); + { + PlcInLst = &Places->Lst[NumPlc]; + HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, + PlcInLst->PlcCod == Ctr_EditingCtr->PlcCod, // Selected? + false, // Not disabled + "%s",PlcInLst->ShrtName); + } HTM_SELECT_End (); HTM_TD_End (); diff --git a/swad_center_config.c b/swad_center_config.c index d85b67c0..e16d7b7b 100644 --- a/swad_center_config.c +++ b/swad_center_config.c @@ -543,6 +543,7 @@ static void CtrCfg_Institution (bool PrintView,bool PutForm) extern const char *Par_CodeStr[]; extern const char *Txt_Institution; unsigned NumIns; + const struct Ins_Instit *InsInLst; /***** Institution *****/ HTM_TR_Begin (NULL); @@ -568,9 +569,13 @@ static void CtrCfg_Institution (bool PrintView,bool PutForm) for (NumIns = 0; NumIns < Gbl.Hierarchy.Inss.Num; NumIns++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod, - Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod,false, - "%s",Gbl.Hierarchy.Inss.Lst[NumIns].ShrtName); + { + InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; + HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, + InsInLst->InsCod == Gbl.Hierarchy.Ins.InsCod, // Selected? + false, // Not disabled + "%s",InsInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); @@ -637,14 +642,11 @@ static void CtrCfg_Place (bool PutForm) struct Plc_Places Places; struct Plc_Place Plc; unsigned NumPlc; + const struct Plc_Place *PlcInLst; /***** Reset places context *****/ Plc_ResetPlaces (&Places); - /***** Get data of place *****/ - Plc.PlcCod = Gbl.Hierarchy.Ctr.PlcCod; - Plc_GetPlaceDataByCod (&Plc); - /***** Place *****/ HTM_TR_Begin (NULL); @@ -655,6 +657,7 @@ static void CtrCfg_Place (bool PutForm) /* Data */ HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); + if (PutForm) { /* Get list of places of the current institution */ @@ -673,9 +676,13 @@ static void CtrCfg_Place (bool PutForm) for (NumPlc = 0; NumPlc < Places.Num; NumPlc++) - HTM_OPTION (HTM_Type_LONG,&Places.Lst[NumPlc].PlcCod, - Places.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Ctr.PlcCod,false, - "%s",Places.Lst[NumPlc].ShrtName); + { + PlcInLst = &Places.Lst[NumPlc]; + HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, + PlcInLst->PlcCod == Gbl.Hierarchy.Ctr.PlcCod, // Selected? + false, // Not disabled + "%s",PlcInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); @@ -683,7 +690,13 @@ static void CtrCfg_Place (bool PutForm) Plc_FreeListPlaces (&Places); } else // I can not change center place + { + /* Text with the place name */ + Plc.PlcCod = Gbl.Hierarchy.Ctr.PlcCod; + Plc_GetPlaceDataByCod (&Plc); HTM_Txt (Plc.FullName); + } + HTM_TD_End (); HTM_TR_End (); diff --git a/swad_changelog.h b/swad_changelog.h index a4b2fe86..174947f5 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,10 +629,18 @@ 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.95 (2023-04-12)" +#define Log_PLATFORM_VERSION "SWAD 22.96 (2023-04-12)" #define CSS_FILE "swad22.95.css" #define JS_FILE "swad22.49.js" /* + Version 22.96: Apr 12, 2023 Changes in configuration of projects. + Code refactoring in selectors. (338977 lines) + 4 changes necessary in database: +ALTER TABLE prj_config CHANGE COLUMN Editable NETCanCreate ENUM('N','Y') NOT NULL DEFAULT 'Y'; +ALTER TABLE prj_config ADD COLUMN RubTutCod INT NOT NULL DEFAULT -1 AFTER CrsCod; +ALTER TABLE prj_config ADD COLUMN RubEvlCod INT NOT NULL DEFAULT -1 AFTER RubTutCod; +ALTER TABLE prj_config ADD COLUMN RubGblCod INT NOT NULL DEFAULT -1 AFTER RubEvlCod; + Version 22.95: Apr 12, 2023 Changes in configuration of projects. (338602 lines) Version 22.94: Apr 12, 2023 Code refactoring in rubrics. Changes in configuration of projects. (338537 lines) diff --git a/swad_country.c b/swad_country.c index c8691195..1cb899cd 100644 --- a/swad_country.c +++ b/swad_country.c @@ -868,6 +868,7 @@ void Cty_WriteSelectorOfCountry (void) { extern const char *Txt_Country; unsigned NumCty; + const struct Cty_Countr *CtyInLst; /***** Get list of countries *****/ Cty_GetBasicListOfCountries (); @@ -881,16 +882,22 @@ void Cty_WriteSelectorOfCountry (void) The_GetSuffix ()); /***** Initial disabled option *****/ - HTM_OPTION (HTM_Type_STRING,"",Gbl.Hierarchy.Cty.CtyCod < 0,true, + HTM_OPTION (HTM_Type_STRING,"", + Gbl.Hierarchy.Cty.CtyCod < 0, // Selected? + true, // Disabled "[%s]",Txt_Country); /***** List countries *****/ for (NumCty = 0; NumCty < Gbl.Hierarchy.Ctys.Num; NumCty++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod, - Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod,false, - "%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + { + CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; + HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, + CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod, // Selected? + false, // Not disabled + "%s",CtyInLst->Name[Gbl.Prefs.Language]); + } /***** End selector of country *****/ HTM_SELECT_End (); diff --git a/swad_course.c b/swad_course.c index 03fcc812..d103500f 100644 --- a/swad_course.c +++ b/swad_course.c @@ -642,7 +642,9 @@ void Crs_WriteSelectorOfCourse (void) The_GetSuffix ()); /***** Initial disabled option *****/ - HTM_OPTION (HTM_Type_STRING,"",Gbl.Hierarchy.Crs.CrsCod < 0,true, + HTM_OPTION (HTM_Type_STRING,"", + Gbl.Hierarchy.Crs.CrsCod < 0, // Selected? + true, // Disabled "[%s]",Txt_Course); if (Gbl.Hierarchy.Deg.DegCod > 0) @@ -663,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,false, + CrsCod == Gbl.Hierarchy.Crs.CrsCod, + false, // Not disabled "%s",row[1]); // Short name (row[1]) } @@ -776,7 +779,9 @@ 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,true, + HTM_OPTION (HTM_Type_STRING,"-1", + true, // Selected + true, // Disabled "%s",Txt_Course); if (Gbl.Usrs.Me.MyCrss.Num) @@ -799,8 +804,9 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) LastDegCod = DegCod; } - HTM_OPTION (HTM_Type_LONG,&Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod, - CrsCod == Gbl.Hierarchy.Crs.CrsCod,false, // Course selected + HTM_OPTION (HTM_Type_LONG,&CrsCod, + CrsCod == Gbl.Hierarchy.Crs.CrsCod, // Selected? + false, // Not disabled "%s",CrsShortName); } @@ -812,7 +818,9 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) when I don't belong to it *****/ 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,true, + HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Crs.CrsCod, + true, // Selected + true, // Disabled "%s",Gbl.Hierarchy.Crs.ShrtName); /***** End selector of courses *****/ @@ -1210,7 +1218,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,false, + YearAux == Crs->Year, // Selected? + false, // Not disabled "%s",Txt_YEAR_OF_DEGREE[YearAux]); HTM_SELECT_End (); Frm_EndForm (); @@ -1352,7 +1361,8 @@ static void Crs_PutFormToCreateCourse (void) Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == Crs_EditingCrs->Year,false, + Year == Crs_EditingCrs->Year, // Selected? + false, // Not disabled "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); HTM_TD_End (); @@ -2544,7 +2554,8 @@ void Crs_AskRemoveOldCrss (void) i <= Crs_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS; i++) HTM_OPTION (HTM_Type_UNSIGNED,&i, - i == MonthsWithoutAccess,false, + i == MonthsWithoutAccess, // Selected? + false, // Not disabled "%u",i); HTM_SELECT_End (); HTM_NBSP (); diff --git a/swad_course_config.c b/swad_course_config.c index 35794c8d..e2ae7d4d 100644 --- a/swad_course_config.c +++ b/swad_course_config.c @@ -214,6 +214,7 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm) extern const char *Par_CodeStr[]; extern const char *Txt_Degree; unsigned NumDeg; + const struct Deg_Degree *DegInLst; /***** Degree *****/ HTM_TR_Begin (NULL); @@ -239,9 +240,13 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm) for (NumDeg = 0; NumDeg < Gbl.Hierarchy.Degs.Num; NumDeg++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Degs.Lst[NumDeg].DegCod, - Gbl.Hierarchy.Degs.Lst[NumDeg].DegCod == Gbl.Hierarchy.Deg.DegCod,false, - "%s",Gbl.Hierarchy.Degs.Lst[NumDeg].ShrtName); + { + DegInLst = &Gbl.Hierarchy.Degs.Lst[NumDeg]; + HTM_OPTION (HTM_Type_LONG,&DegInLst->DegCod, + DegInLst->DegCod == Gbl.Hierarchy.Deg.DegCod, // Selected? + false, // Not disabled + "%s",DegInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); @@ -326,7 +331,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,false, + Year == Gbl.Hierarchy.Crs.Year, // Selected? + false, // Not disabled "%s",Txt_YEAR_OF_DEGREE[Year]); HTM_SELECT_End (); Frm_EndForm (); diff --git a/swad_database.c b/swad_database.c index fe1abfa2..be1f68ed 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2554,17 +2554,23 @@ mysql> DESCRIBE prg_resources; /***** Table prj_config *****/ /* mysql> DESCRIBE prj_config; -+----------+---------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+----------+---------------+------+-----+---------+-------+ -| CrsCod | int(11) | NO | PRI | -1 | | -| Editable | enum('N','Y') | NO | | Y | | -+----------+---------------+------+-----+---------+-------+ -2 rows in set (0.00 sec) ++--------------+---------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++--------------+---------------+------+-----+---------+-------+ +| CrsCod | int | NO | PRI | -1 | | +| RubTutCod | int | NO | | -1 | | +| RubEvlCod | int | NO | | -1 | | +| RubGblCod | int | NO | | -1 | | +| NETCanCreate | enum('N','Y') | NO | | Y | | ++--------------+---------------+------+-----+---------+-------+ +5 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS prj_config (" "CrsCod INT NOT NULL DEFAULT -1," - "Editable ENUM('N','Y') NOT NULL DEFAULT 'Y'," + "RubTutCod INT NOT NULL DEFAULT -1," + "RubEvlCod INT NOT NULL DEFAULT -1," + "RubGblCod INT NOT NULL DEFAULT -1," + "NETCanCreate ENUM('N','Y') NOT NULL DEFAULT 'Y'," "UNIQUE INDEX(CrsCod))"); /***** Table prj_projects *****/ diff --git a/swad_date.c b/swad_date.c index 50e4f441..03989abd 100644 --- a/swad_date.c +++ b/swad_date.c @@ -766,7 +766,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Year = FirstYear; Year <= LastYear; Year++) - HTM_OPTION (HTM_Type_UNSIGNED,&Year,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Year, + false, // Not selected + false, // Not disabled "%u",Year); HTM_SELECT_End (); HTM_TD_End (); @@ -781,7 +783,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Month = 1; Month <= 12; Month++) - HTM_OPTION (HTM_Type_UNSIGNED,&Month,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Month, + false, // Not selected + false, // Not disabled "%s",Txt_MONTHS_SMALL[Month - 1]); HTM_SELECT_End (); HTM_TD_End (); @@ -796,7 +800,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Day = 1; Day <= 31; Day++) - HTM_OPTION (HTM_Type_UNSIGNED,&Day,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Day, + false, // Not selected + false, // Not disabled "%u",Day); HTM_SELECT_End (); HTM_TD_End (); @@ -811,7 +817,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Hour = 0; Hour <= 23; Hour++) - HTM_OPTION (HTM_Type_UNSIGNED,&Hour,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Hour, + false, // Not selected + false, // Not disabled "%02u h",Hour); HTM_SELECT_End (); HTM_TD_End (); @@ -826,7 +834,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Minute = 0; Minute < 60; Minute += MinutesIInterval[FormSeconds]) - HTM_OPTION (HTM_Type_UNSIGNED,&Minute,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Minute, + false, // Not selected + false, // Not disabled "%02u ′",Minute); HTM_SELECT_End (); HTM_TD_End (); @@ -843,7 +853,9 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, for (Second = 0; Second <= 59; Second++) - HTM_OPTION (HTM_Type_UNSIGNED,&Second,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&Second, + false, // Not selected + false, // Not disabled "%02u ″",Second); HTM_SELECT_End (); HTM_TD_End (); @@ -1008,13 +1020,16 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, The_GetSuffix (), Disabled ? " disabled=\"disabled\"" : ""); - HTM_OPTION (HTM_Type_STRING,"0",false,false, + HTM_OPTION (HTM_Type_STRING,"0", + false, // Not selected + false, // Not disabled "-"); for (Year = FirstYear; Year <= LastYear; Year++) HTM_OPTION (HTM_Type_UNSIGNED,&Year, - Year == DateSelected->Year,false, + Year == DateSelected->Year, // Selected? + false, // Not disabled "%u",Year); HTM_SELECT_End (); HTM_TD_End (); @@ -1028,13 +1043,16 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, The_GetSuffix (), Disabled ? " disabled=\"disabled\"" : ""); - HTM_OPTION (HTM_Type_STRING,"0",false,false, + HTM_OPTION (HTM_Type_STRING,"0", + false, // Not selected + false, // Not disabled "-"); for (Month = 1; Month <= 12; Month++) HTM_OPTION (HTM_Type_UNSIGNED,&Month, - Month == DateSelected->Month,false, + Month == DateSelected->Month, // Selected? + false, // Not disabled "%s",Txt_MONTHS_SMALL[Month - 1]); HTM_SELECT_End (); HTM_TD_End (); @@ -1050,7 +1068,9 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, The_GetSuffix (), Disabled ? " disabled=\"disabled\"" : ""); - HTM_OPTION (HTM_Type_STRING,"0",false,false, + HTM_OPTION (HTM_Type_STRING,"0", + false, // Not selected + false, // Not disabled "-"); NumDaysSelectedMonth = (DateSelected->Month == 0) ? 31 : ((DateSelected->Month == 2) ? Dat_GetNumDaysFebruary (DateSelected->Year) : @@ -1059,7 +1079,8 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Day <= NumDaysSelectedMonth; Day++) HTM_OPTION (HTM_Type_UNSIGNED,&Day, - Day == DateSelected->Day,false, + Day == DateSelected->Day, // Selected? + false, // Not disabled "%u",Day); HTM_SELECT_End (); HTM_TD_End (); diff --git a/swad_degree.c b/swad_degree.c index 3e3341cf..da64e8c8 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -241,7 +241,8 @@ void Deg_WriteSelectorOfDegree (void) " disabled=\"disabled\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Deg.DegCod < 0,true, + Gbl.Hierarchy.Deg.DegCod <= 0, // Selected? + true, // Disabled "[%s]",Txt_Degree); if (Gbl.Hierarchy.Ctr.CtrCod > 0) @@ -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,false, + DegCod == Gbl.Hierarchy.Deg.DegCod, // Selected? + false, // Not disabled "%s",row[1]); } @@ -312,9 +314,9 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) { extern const char *Txt_DEGREE_STATUS[Hie_NUM_STATUS_TXT]; unsigned NumDeg; - struct DegTyp_DegreeType *DegTyp; - struct Deg_Degree *Deg; + struct Deg_Degree *DegInLst; unsigned NumDegTyp; + struct DegTyp_DegreeType *DegTypInLst; char WWW[Cns_MAX_BYTES_WWW + 1]; struct Usr_Data UsrDat; bool ICanEdit; @@ -335,11 +337,11 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) NumDeg < Gbl.Hierarchy.Degs.Num; NumDeg++) { - Deg = &(Gbl.Hierarchy.Degs.Lst[NumDeg]); + DegInLst = &(Gbl.Hierarchy.Degs.Lst[NumDeg]); - ICanEdit = Deg_CheckIfICanEditADegree (Deg); - NumCrss = Crs_GetNumCrssInDeg (Deg->DegCod); - NumUsrsInCrssOfDeg = Enr_GetNumUsrsInCrss (HieLvl_DEG,Deg->DegCod, + ICanEdit = Deg_CheckIfICanEditADegree (DegInLst); + NumCrss = Crs_GetNumCrssInDeg (DegInLst->DegCod); + NumUsrsInCrssOfDeg = Enr_GetNumUsrsInCrss (HieLvl_DEG,DegInLst->DegCod, 1 << Rol_STD | 1 << Rol_NET | 1 << Rol_TCH); // Any user @@ -354,17 +356,17 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) Ico_PutIconRemovalNotAllowed (); else Ico_PutContextualIconToRemove (ActRemDeg,NULL, - Hie_PutParOtherHieCod,&Deg->DegCod); + Hie_PutParOtherHieCod,&DegInLst->DegCod); HTM_TD_End (); /* Degree code */ HTM_TD_Begin ("class=\"DAT_%s CODE\"",The_GetSuffix ()); - HTM_Long (Deg->DegCod); + HTM_Long (DegInLst->DegCod); HTM_TD_End (); /* Degree logo */ - HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg->FullName); - Lgo_DrawLogo (HieLvl_DEG,Deg->DegCod,Deg->ShrtName,20,NULL,true); + HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",DegInLst->FullName); + Lgo_DrawLogo (HieLvl_DEG,DegInLst->DegCod,DegInLst->ShrtName,20,NULL,true); HTM_TD_End (); /* Degree short name */ @@ -372,15 +374,15 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) if (ICanEdit) { Frm_BeginForm (ActRenDegSho); - ParCod_PutPar (ParCod_OthHie,Deg->DegCod); - HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Deg->ShrtName, + ParCod_PutPar (ParCod_OthHie,DegInLst->DegCod); + HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,DegInLst->ShrtName, HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_SHORT_NAME INPUT_%s\"", The_GetSuffix ()); Frm_EndForm (); } else - HTM_Txt (Deg->ShrtName); + HTM_Txt (DegInLst->ShrtName); HTM_TD_End (); /* Degree full name */ @@ -388,15 +390,15 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) if (ICanEdit) { Frm_BeginForm (ActRenDegFul); - ParCod_PutPar (ParCod_OthHie,Deg->DegCod); - HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Deg->FullName, + ParCod_PutPar (ParCod_OthHie,DegInLst->DegCod); + HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,DegInLst->FullName, HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_FULL_NAME INPUT_%s\"", The_GetSuffix ()); Frm_EndForm (); } else - HTM_Txt (Deg->FullName); + HTM_Txt (DegInLst->FullName); HTM_TD_End (); /* Degree type */ @@ -404,7 +406,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) if (ICanEdit) { Frm_BeginForm (ActChgDegTyp); - ParCod_PutPar (ParCod_OthHie,Deg->DegCod); + ParCod_PutPar (ParCod_OthHie,DegInLst->DegCod); HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, "name=\"OthDegTypCod\"" " class=\"HIE_SEL_NARROW INPUT_%s\"", @@ -413,11 +415,11 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) NumDegTyp < DegTypes->Num; NumDegTyp++) { - DegTyp = &DegTypes->Lst[NumDegTyp]; - HTM_OPTION (HTM_Type_LONG,&DegTyp->DegTypCod, - // Gbl.Hierarchy.Deg.DegCod > 0 && - DegTyp->DegTypCod == Deg->DegTypCod,false, - "%s",DegTyp->DegTypName); + DegTypInLst = &DegTypes->Lst[NumDegTyp]; + HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, + DegTypInLst->DegTypCod == DegInLst->DegTypCod, // Selected? + false, // Not disabled + "%s",DegTypInLst->DegTypName); } HTM_SELECT_End (); Frm_EndForm (); @@ -426,8 +428,11 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) for (NumDegTyp = 0; NumDegTyp < DegTypes->Num; NumDegTyp++) - if (DegTypes->Lst[NumDegTyp].DegTypCod == Deg->DegTypCod) - HTM_Txt (DegTypes->Lst[NumDegTyp].DegTypName); + { + DegTypInLst = &DegTypes->Lst[NumDegTyp]; + if (DegTypInLst->DegTypCod == DegInLst->DegTypCod) + HTM_Txt (DegTypInLst->DegTypName); + } HTM_TD_End (); /* Degree WWW */ @@ -435,8 +440,8 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) if (ICanEdit) { Frm_BeginForm (ActChgDegWWW); - ParCod_PutPar (ParCod_OthHie,Deg->DegCod); - HTM_INPUT_URL ("WWW",Deg->WWW,HTM_SUBMIT_ON_CHANGE, + ParCod_PutPar (ParCod_OthHie,DegInLst->DegCod); + HTM_INPUT_URL ("WWW",DegInLst->WWW,HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_WWW_NARROW INPUT_%s\"" " required=\"required\"", The_GetSuffix ()); @@ -444,12 +449,12 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) } else { - Str_Copy (WWW,Deg->WWW,sizeof (WWW) - 1); + Str_Copy (WWW,DegInLst->WWW,sizeof (WWW) - 1); HTM_DIV_Begin ("class=\"EXTERNAL_WWW_SHORT\""); HTM_A_Begin ("href=\"%s\" target=\"_blank\" title=\"%s\"" " class=\"DAT_%s\"", - Deg->WWW, - Deg->WWW, + DegInLst->WWW, + DegInLst->WWW, The_GetSuffix ()); HTM_Txt (WWW); HTM_A_End (); @@ -468,7 +473,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) HTM_TD_End (); /* Degree requester */ - UsrDat.UsrCod = Deg->RequesterUsrCod; + UsrDat.UsrCod = DegInLst->RequesterUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, Usr_DONT_GET_ROLE_IN_CURRENT_CRS); @@ -479,7 +484,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) /* Degree status */ Hie_WriteStatusCellEditable (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM, - Deg->Status,ActChgDegSta,Deg->DegCod, + DegInLst->Status,ActChgDegSta,DegInLst->DegCod, Txt_DEGREE_STATUS); HTM_TR_End (); @@ -511,8 +516,8 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes) { extern const char *Txt_New_degree; extern const char *Txt_Create_degree; - struct DegTyp_DegreeType *DegTyp; unsigned NumDegTyp; + struct DegTyp_DegreeType *DegTypInLst; /***** Begin form *****/ if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) @@ -573,10 +578,11 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes) NumDegTyp < DegTypes->Num; NumDegTyp++) { - DegTyp = &DegTypes->Lst[NumDegTyp]; - HTM_OPTION (HTM_Type_LONG,&DegTyp->DegTypCod, - DegTyp->DegTypCod == Deg_EditingDeg->DegTypCod,false, - "%s",DegTyp->DegTypName); + DegTypInLst = &DegTypes->Lst[NumDegTyp]; + HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, + DegTypInLst->DegTypCod == Deg_EditingDeg->DegTypCod, // Selected? + false, // Not disabled + "%s",DegTypInLst->DegTypName); } HTM_SELECT_End (); HTM_TD_End (); diff --git a/swad_degree_config.c b/swad_degree_config.c index 6c511435..7ff5be78 100644 --- a/swad_degree_config.c +++ b/swad_degree_config.c @@ -209,6 +209,7 @@ static void DegCfg_Center (bool PrintView,bool PutForm) extern const char *Par_CodeStr[]; extern const char *Txt_Center; unsigned NumCtr; + const struct Ctr_Center *CtrInLst; /***** Center *****/ HTM_TR_Begin (NULL); @@ -234,9 +235,13 @@ static void DegCfg_Center (bool PrintView,bool PutForm) for (NumCtr = 0; NumCtr < Gbl.Hierarchy.Ctrs.Num; NumCtr++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod, - Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod,false, - "%s",Gbl.Hierarchy.Ctrs.Lst[NumCtr].ShrtName); + { + CtrInLst = &Gbl.Hierarchy.Ctrs.Lst[NumCtr]; + HTM_OPTION (HTM_Type_LONG,&CtrInLst->CtrCod, + CtrInLst->CtrCod == Gbl.Hierarchy.Ctr.CtrCod, // Selected? + false, // Not disabled + "%s",CtrInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); diff --git a/swad_degree_type.c b/swad_degree_type.c index 0dcd5e56..bea6c271 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -105,6 +105,7 @@ void DegTyp_WriteSelectorDegreeTypes (long SelectedDegTypCod) extern const char *Txt_Any_type_of_degree; struct DegTyp_DegTypes DegTypes; unsigned NumDegTyp; + const struct DegTyp_DegreeType *DegTypInLst; /***** Form to select degree types *****/ /* Get list of degree types */ @@ -116,14 +117,19 @@ void DegTyp_WriteSelectorDegreeTypes (long SelectedDegTypCod) " class=\"INPUT_%s\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"-1", - SelectedDegTypCod == -1L,false, + SelectedDegTypCod <= 0, // Selected? + false, // Not disabled "%s",Txt_Any_type_of_degree); for (NumDegTyp = 0; NumDegTyp < DegTypes.Num; NumDegTyp++) - HTM_OPTION (HTM_Type_LONG,&DegTypes.Lst[NumDegTyp].DegTypCod, - DegTypes.Lst[NumDegTyp].DegTypCod == SelectedDegTypCod,false, - "%s",DegTypes.Lst[NumDegTyp].DegTypName); + { + DegTypInLst = &DegTypes.Lst[NumDegTyp]; + HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod, + DegTypInLst->DegTypCod == SelectedDegTypCod, // Selected? + false, // Not disabled + "%s",DegTypInLst->DegTypName); + } HTM_SELECT_End (); /***** Free list of degree types *****/ diff --git a/swad_department.c b/swad_department.c index 3aa5966a..61435cbd 100644 --- a/swad_department.c +++ b/swad_department.c @@ -442,9 +442,10 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm { extern const char *Txt_Another_institution; unsigned NumDpt; - struct Dpt_Department *Dpt; + struct Dpt_Department *DptInLst; struct Ins_Instit Ins; unsigned NumIns; + struct Ins_Instit *InsInLst; /***** Begin table *****/ HTM_TABLE_BeginPadding (2); @@ -457,44 +458,50 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm NumDpt < Departments->Num; NumDpt++) { - Dpt = &Departments->Lst[NumDpt]; + DptInLst = &Departments->Lst[NumDpt]; /* Get data of institution of this department */ - Ins.InsCod = Dpt->InsCod; + Ins.InsCod = DptInLst->InsCod; Ins_GetInstitDataByCod (&Ins); HTM_TR_Begin (NULL); /* Put icon to remove department */ HTM_TD_Begin ("class=\"BM\""); - if (Dpt->NumTchs) // Department has teachers ==> deletion forbidden + if (DptInLst->NumTchs) // Department has teachers ==> deletion forbidden Ico_PutIconRemovalNotAllowed (); else Ico_PutContextualIconToRemove (ActRemDpt,NULL, - Dpt_PutParDptCod,&Dpt->DptCod); + Dpt_PutParDptCod,&DptInLst->DptCod); HTM_TD_End (); /* Department code */ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ()); - HTM_TxtF ("%ld ",Dpt->DptCod); + HTM_TxtF ("%ld ",DptInLst->DptCod); HTM_TD_End (); /* Institution */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgDptIns); - ParCod_PutPar (ParCod_Dpt,Dpt->DptCod); + ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod); HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, "name=\"OthInsCod\"" " class=\"HIE_SEL_NARROW INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"0",Dpt->InsCod == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + DptInLst->InsCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_institution); for (NumIns = 0; NumIns < Gbl.Hierarchy.Inss.Num; NumIns++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod, - Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Dpt->InsCod,false, - "%s",Gbl.Hierarchy.Inss.Lst[NumIns].ShrtName); + { + InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; + HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, + InsInLst->InsCod == DptInLst->InsCod, // Selected? + false, // Not disabled + "%s",InsInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -502,8 +509,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm /* Department short name */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActRenDptSho); - ParCod_PutPar (ParCod_Dpt,Dpt->DptCod); - HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Dpt->ShrtName, + ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod); + HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,DptInLst->ShrtName, HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_SHORT_NAME INPUT_%s\"", The_GetSuffix ()); @@ -513,8 +520,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm /* Department full name */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActRenDptFul); - ParCod_PutPar (ParCod_Dpt,Dpt->DptCod); - HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Dpt->FullName, + ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod); + HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,DptInLst->FullName, HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_FULL_NAME INPUT_%s\"", The_GetSuffix ()); @@ -524,8 +531,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm /* Department WWW */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgDptWWW); - ParCod_PutPar (ParCod_Dpt,Dpt->DptCod); - HTM_INPUT_URL ("WWW",Dpt->WWW,HTM_SUBMIT_ON_CHANGE, + ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod); + HTM_INPUT_URL ("WWW",DptInLst->WWW,HTM_SUBMIT_ON_CHANGE, "class=\"INPUT_WWW_NARROW INPUT_%s\"" " required=\"required\"", The_GetSuffix ()); @@ -534,7 +541,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm /* Number of teachers */ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ()); - HTM_Unsigned (Dpt->NumTchs); + HTM_Unsigned (DptInLst->NumTchs); HTM_TD_End (); HTM_TR_End (); @@ -789,6 +796,7 @@ static void Dpt_PutFormToCreateDepartment (void) extern const char *Txt_Another_institution; extern const char *Txt_Create_department; unsigned NumIns; + const struct Ins_Instit *InsInLst; /***** Begin form *****/ Frm_BeginForm (ActNewDpt); @@ -814,14 +822,20 @@ static void Dpt_PutFormToCreateDepartment (void) "name=\"OthInsCod\"" " class=\"HIE_SEL_NARROW INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"0",Dpt_EditingDpt->InsCod == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + Dpt_EditingDpt->InsCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_institution); for (NumIns = 0; NumIns < Gbl.Hierarchy.Inss.Num; NumIns++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod, - Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Dpt_EditingDpt->InsCod,false, - "%s",Gbl.Hierarchy.Inss.Lst[NumIns].ShrtName); + { + InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; + HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, + InsInLst->InsCod == Dpt_EditingDpt->InsCod, // Selected? + false, // Not disabled + "%s",InsInLst->ShrtName); + } HTM_SELECT_End (); HTM_TD_End (); @@ -988,6 +1002,7 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, extern const char *Txt_Another_department; struct Dpt_Departments Departments; unsigned NumDpt; + const struct Dpt_Department *DptInLst; bool NoDptSelectable; /***** Reset departments context *****/ @@ -1012,12 +1027,16 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, if (TextWhenNoDptSelected[0]) NoDptSelectable = true; - HTM_OPTION (HTM_Type_STRING,"-1",DptCod < 0,!NoDptSelectable, + HTM_OPTION (HTM_Type_STRING,"-1", + DptCod < 0, // Selected? + !NoDptSelectable, // Disabled? "%s",TextWhenNoDptSelected); } /* Another department selected (different to all departments listed) */ - HTM_OPTION (HTM_Type_STRING,"0",DptCod == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + DptCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_department); } @@ -1025,9 +1044,13 @@ void Dpt_WriteSelectorDepartment (long InsCod,long DptCod, for (NumDpt = 0; NumDpt < Departments.Num; NumDpt++) - HTM_OPTION (HTM_Type_LONG,&Departments.Lst[NumDpt].DptCod, - Departments.Lst[NumDpt].DptCod == DptCod,false, - "%s",Departments.Lst[NumDpt].FullName); + { + DptInLst = &Departments.Lst[NumDpt]; + HTM_OPTION (HTM_Type_LONG,&DptInLst->DptCod, + DptInLst->DptCod == DptCod, // Selected? + false, // Not disabled + "%s",DptInLst->FullName); + } /* End selector */ HTM_SELECT_End (); diff --git a/swad_enrolment.c b/swad_enrolment.c index 02f2d259..e6e8a254 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,false, + Months == Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS, // Selected? + false, // Not disabled "%u",Months); HTM_SELECT_End (); HTM_NBSP (); diff --git a/swad_exam_print.c b/swad_exam_print.c index 0dabf6f4..90a342b2 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -815,9 +815,18 @@ static void ExaPrn_WriteTF_AnsToFill (const struct ExaPrn_Print *Print, HTM_TxtF (""); } diff --git a/swad_figure.c b/swad_figure.c index fac2f8a5..6e082cc4 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,false, + FigType == SelectedFigureType, // Selected? + false, // Not disabled? "%s",Txt_FIGURE_TYPES[FigType]); } HTM_SELECT_End (); diff --git a/swad_group.c b/swad_group.c index 47773ed4..5d89273e 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1264,10 +1264,12 @@ 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,false, + !Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment, // Selected? + false, // Not disabled "%s",Txt_It_is_optional_to_choose_a_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment,false, + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment, // Selected? + false, // Not disabled "%s",Txt_It_is_mandatory_to_choose_a_group); HTM_SELECT_End (); Frm_EndForm (); @@ -1282,10 +1284,12 @@ 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,false, + !Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment, // Selected? + false, // Not disabled "%s",Txt_A_student_can_only_belong_to_one_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment,false, + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment, // Selected? + false, // Not disabled "%s",Txt_A_student_can_belong_to_several_groups); HTM_SELECT_End (); Frm_EndForm (); @@ -1400,13 +1404,14 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) { extern const char *Txt_No_assigned_room; extern const char *Txt_Another_room; - unsigned NumGrpTyp; - unsigned NumTipGrpAux; + unsigned NumGrpTyp1; + const struct GroupType *GrpTyp1InLst; + unsigned NumGrpTyp2; + const struct GroupType *GrpTyp2InLst; unsigned NumGrpThisType; - unsigned NumRoo; - struct GroupType *GrpTyp; - struct GroupType *GrpTypAux; struct Group *Grp; + unsigned NumRoo; + const struct Roo_Room *RooInLst; Rol_Role_t Role; char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; @@ -1417,16 +1422,16 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) Grp_WriteHeadingGroups (); /***** List the groups *****/ - for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; - NumGrpTyp++) + for (NumGrpTyp1 = 0; + NumGrpTyp1 < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; + NumGrpTyp1++) { - GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp1InLst = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp1]; for (NumGrpThisType = 0; - NumGrpThisType < GrpTyp->NumGrps; + NumGrpThisType < GrpTyp1InLst->NumGrps; NumGrpThisType++) { - Grp = &(GrpTyp->LstGrps[NumGrpThisType]); + Grp = &GrpTyp1InLst->LstGrps[NumGrpThisType]; HTM_TR_Begin (NULL); @@ -1477,14 +1482,15 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) The_GetSuffix ()); /* Options for group types */ - for (NumTipGrpAux = 0; - NumTipGrpAux < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; - NumTipGrpAux++) + for (NumGrpTyp2 = 0; + NumGrpTyp2 < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; + NumGrpTyp2++) { - GrpTypAux = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumTipGrpAux]; - HTM_OPTION (HTM_Type_LONG,&GrpTypAux->GrpTypCod, - GrpTypAux->GrpTypCod == GrpTyp->GrpTypCod,false, - "%s",GrpTypAux->GrpTypName); + GrpTyp2InLst = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp2]; + HTM_OPTION (HTM_Type_LONG,&GrpTyp2InLst->GrpTypCod, + GrpTyp2InLst->GrpTypCod == GrpTyp1InLst->GrpTypCod, // Selected? + false, // Not disabled + "%s",GrpTyp2InLst->GrpTypName); } /* End selector */ @@ -1515,7 +1521,8 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) /* Option for no assigned room */ HTM_OPTION (HTM_Type_STRING,"-1", - Grp->Room.RooCod < 0,false, + Grp->Room.RooCod < 0, // Selected? + false, // Not disabled "%s",Txt_No_assigned_room); /* Option for another room */ @@ -1527,9 +1534,13 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) for (NumRoo = 0; NumRoo < Rooms->Num; NumRoo++) - HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumRoo].RooCod, - Rooms->Lst[NumRoo].RooCod == Grp->Room.RooCod,false, - "%s",Rooms->Lst[NumRoo].ShrtName); + { + RooInLst = &Rooms->Lst[NumRoo]; + HTM_OPTION (HTM_Type_LONG,&RooInLst->RooCod, + RooInLst->RooCod == Grp->Room.RooCod, // Selected + false, // Not disabled + "%s",RooInLst->ShrtName); + } /* End selector */ HTM_SELECT_End (); @@ -2437,10 +2448,12 @@ static void Grp_PutFormToCreateGroupType (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment,false, + !Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment, // Selected? + false, // Not disabled "%s",Txt_It_is_optional_to_choose_a_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment,false, + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment, // Selected? + false, // Not disabled "%s",Txt_It_is_mandatory_to_choose_a_group); HTM_SELECT_End (); HTM_TD_End (); @@ -2452,10 +2465,12 @@ static void Grp_PutFormToCreateGroupType (void) " class=\"INPUT_%s\" style=\"width:150px;\"", The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"N", - !Gbl.Crs.Grps.GrpTyp.MultipleEnrolment,false, + !Gbl.Crs.Grps.GrpTyp.MultipleEnrolment, // Selected? + false, // Not disabled "%s",Txt_A_student_can_only_belong_to_one_group); HTM_OPTION (HTM_Type_STRING,"Y", - Gbl.Crs.Grps.GrpTyp.MultipleEnrolment,false, + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment, // Selected? + false, // Not disabled "%s",Txt_A_student_can_belong_to_several_groups); HTM_SELECT_End (); HTM_TD_End (); @@ -2520,7 +2535,9 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) extern const char *Txt_Another_room; extern const char *Txt_Create_group; unsigned NumGrpTyp; + const struct GroupType *GrpTypInLst; unsigned NumRoo; + const struct Roo_Room *RooInLst; Rol_Role_t Role; char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; @@ -2566,10 +2583,13 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) for (NumGrpTyp = 0; NumGrpTyp < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; NumGrpTyp++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod == - Gbl.Crs.Grps.GrpTyp.GrpTypCod,false, - "%s",Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); + { + GrpTypInLst = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + HTM_OPTION (HTM_Type_LONG,&GrpTypInLst->GrpTypCod, + GrpTypInLst->GrpTypCod == Gbl.Crs.Grps.GrpTyp.GrpTypCod, // Selected? + false, // Not disabled + "%s",GrpTypInLst->GrpTypName); + } /* End selector */ HTM_SELECT_End (); @@ -2593,20 +2613,28 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) The_GetSuffix ()); /* Option for no assigned room */ - HTM_OPTION (HTM_Type_STRING,"-1",Gbl.Crs.Grps.RooCod < 0,false, + HTM_OPTION (HTM_Type_STRING,"-1", + Gbl.Crs.Grps.RooCod < 0, // Selected? + false, // Not disabled "%s",Txt_No_assigned_room); /* Option for another room */ - HTM_OPTION (HTM_Type_STRING,"0",Gbl.Crs.Grps.RooCod == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + Gbl.Crs.Grps.RooCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_room); /* Options for rooms */ for (NumRoo = 0; NumRoo < Rooms->Num; NumRoo++) - HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumRoo].RooCod, - Rooms->Lst[NumRoo].RooCod == Gbl.Crs.Grps.RooCod,false, - "%s",Rooms->Lst[NumRoo].ShrtName); + { + RooInLst = &Rooms->Lst[NumRoo]; + HTM_OPTION (HTM_Type_LONG,&RooInLst->RooCod, + RooInLst->RooCod == Gbl.Crs.Grps.RooCod, // Selected? + false, // Not disabled + "%s",RooInLst->ShrtName); + } /* End selector */ HTM_SELECT_End (); diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 149184e2..ba26e817 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -810,11 +810,15 @@ void Hie_WriteStatusCellEditable (bool ICanEdit,Hie_Status_t Status, "name=\"Status\" class=\"INPUT_STATUS\""); StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_PENDING); - HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,true,false, + HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned, + true, // Selected + false, // Not disabled "%s",Txt[Hie_STATUS_PENDING]); StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_ACTIVE); - HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,false,false, + HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned, + false, // Not selected + false, // Not disabled "%s",Txt[Hie_STATUS_ACTIVE]); HTM_SELECT_End (); diff --git a/swad_holiday.c b/swad_holiday.c index 519427fa..a2a73259 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -481,8 +481,9 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, extern const char *Txt_All_places; extern const char *Txt_HOLIDAY_TYPES[Hld_NUM_TYPES_HOLIDAY]; unsigned NumHld; + struct Hld_Holiday *HldInLst; unsigned NumPlc; - struct Hld_Holiday *Hld; + const struct Plc_Place *PlcInLst; Hld_HolidayType_t HolidayType; unsigned HolidayTypeUnsigned; unsigned CurrentYear = Dat_GetCurrentYear (); @@ -500,36 +501,42 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, NumHld < Holidays->Num; NumHld++) { - Hld = &Holidays->Lst[NumHld]; + HldInLst = &Holidays->Lst[NumHld]; HTM_TR_Begin (NULL); /* Put icon to remove holiday */ HTM_TD_Begin ("class=\"BM\""); Ico_PutContextualIconToRemove (ActRemHld,NULL, - Hld_PutParHldCod,&Hld->HldCod); + Hld_PutParHldCod,&HldInLst->HldCod); HTM_TD_End (); /* Holiday code */ HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ()); - HTM_TxtF ("%ld ",Hld->HldCod); + HTM_TxtF ("%ld ",HldInLst->HldCod); HTM_TD_End (); /* Holiday place */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgHldPlc); - ParCod_PutPar (ParCod_Hld,Hld->HldCod); + ParCod_PutPar (ParCod_Hld,HldInLst->HldCod); HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, "name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"-1",Hld->PlcCod <= 0,false, + HTM_OPTION (HTM_Type_STRING,"-1", + HldInLst->PlcCod <= 0, // Selected? + false, // Not disabled "%s",Txt_All_places); for (NumPlc = 0; NumPlc < Places->Num; NumPlc++) - HTM_OPTION (HTM_Type_LONG,&Places->Lst[NumPlc].PlcCod, - Places->Lst[NumPlc].PlcCod == Hld->PlcCod,false, - "%s",Places->Lst[NumPlc].ShrtName); + { + PlcInLst = &Places->Lst[NumPlc]; + HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, + PlcInLst->PlcCod == HldInLst->PlcCod, // Selected? + false, // Not disabled + "%s",PlcInLst->ShrtName); + } HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -537,7 +544,7 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, /* Holiday type */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgHldTyp); - ParCod_PutPar (ParCod_Hld,Hld->HldCod); + ParCod_PutPar (ParCod_Hld,HldInLst->HldCod); HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, "name=\"HldTyp\" class=\"INPUT_%s\"" " style=\"width:62px;\"", // TODO: Use a CSS class @@ -548,7 +555,8 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, { HolidayTypeUnsigned = (unsigned) HolidayType; HTM_OPTION (HTM_Type_UNSIGNED,&HolidayTypeUnsigned, - HolidayType == Hld->HldTyp,false, + HolidayType == HldInLst->HldTyp, // Selected? + false, // Not disabled "%s",Txt_HOLIDAY_TYPES[HolidayType]); } HTM_SELECT_End (); @@ -558,7 +566,7 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, /* Holiday date / Non school period start date */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgHldStrDat); - ParCod_PutPar (ParCod_Hld,Hld->HldCod); + ParCod_PutPar (ParCod_Hld,HldInLst->HldCod); Dat_WriteFormDate (CurrentYear - 1, CurrentYear + 1, "Start", @@ -571,21 +579,21 @@ static void Hld_ListHolidaysForEdition (const struct Hld_Holidays *Holidays, /* Non school period end date */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgHldEndDat); - ParCod_PutPar (ParCod_Hld,Hld->HldCod); + ParCod_PutPar (ParCod_Hld,HldInLst->HldCod); Dat_WriteFormDate (CurrentYear - 1, CurrentYear + 1, "End", &(Holidays->Lst[NumHld].EndDate), HTM_SUBMIT_ON_CHANGE, - (Hld->HldTyp == Hld_HOLIDAY)); + (HldInLst->HldTyp == Hld_HOLIDAY)); Frm_EndForm (); HTM_TD_End (); /* Holiday name */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActRenHld); - ParCod_PutPar (ParCod_Hld,Hld->HldCod); - HTM_INPUT_TEXT ("Name",Hld_MAX_CHARS_HOLIDAY_NAME,Hld->Name, + ParCod_PutPar (ParCod_Hld,HldInLst->HldCod); + HTM_INPUT_TEXT ("Name",Hld_MAX_CHARS_HOLIDAY_NAME,HldInLst->Name, HTM_SUBMIT_ON_CHANGE, "size=\"20\" class=\"INPUT_%s\"", The_GetSuffix ()); @@ -654,10 +662,8 @@ void Hld_ChangeHolidayPlace (void) // <0 (place unspecified/all places) and 0 (another place) are allowed here NewPlace.PlcCod = ParCod_GetPar (ParCod_Plc); - /***** Get from the database the data of the place *****/ + /***** Get place and holiday data from database *****/ Plc_GetPlaceDataByCod (&NewPlace); - - /***** Get from the database the data of the holiday *****/ Hld_GetHolidayDataByCod (Hld_EditingHld); /***** Update the place in database *****/ @@ -866,6 +872,7 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) extern const char *Txt_HOLIDAY_TYPES[Hld_NUM_TYPES_HOLIDAY]; extern const char *Txt_Create_holiday; unsigned NumPlc; + const struct Plc_Place *PlcInLst; Hld_HolidayType_t HolidayType; unsigned HolidayTypeUnsigned; unsigned CurrentYear = Dat_GetCurrentYear (); @@ -894,14 +901,20 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, "name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"-1",Hld_EditingHld->PlcCod <= 0,false, + HTM_OPTION (HTM_Type_STRING,"-1", + Hld_EditingHld->PlcCod <= 0, // Selected? + false, // Not disabled "%s",Txt_All_places); for (NumPlc = 0; NumPlc < Places->Num; NumPlc++) - HTM_OPTION (HTM_Type_LONG,&Places->Lst[NumPlc].PlcCod, - Places->Lst[NumPlc].PlcCod == Hld_EditingHld->PlcCod,false, - "%s",Places->Lst[NumPlc].ShrtName); + { + PlcInLst = &Places->Lst[NumPlc]; + HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod, + PlcInLst->PlcCod == Hld_EditingHld->PlcCod, // Selected? + false, // Not disabled + "%s",PlcInLst->ShrtName); + } HTM_SELECT_End (); HTM_TD_End (); @@ -917,7 +930,8 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places) { HolidayTypeUnsigned = (unsigned) HolidayType; HTM_OPTION (HTM_Type_UNSIGNED,&HolidayTypeUnsigned, - HolidayType == Hld_EditingHld->HldTyp,false, + HolidayType == Hld_EditingHld->HldTyp, // Selected? + false, // Not disabled "%s",Txt_HOLIDAY_TYPES[HolidayType]); } HTM_SELECT_End (); diff --git a/swad_institution.c b/swad_institution.c index 26d11a7c..683ed980 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -878,7 +878,8 @@ void Ins_WriteSelectorOfInstitution (void) The_GetSuffix ()); HTM_OPTION (HTM_Type_STRING,"", - Gbl.Hierarchy.Ins.InsCod < 0,true, + Gbl.Hierarchy.Ins.InsCod < 0, // Selected? + true, // Disabled "[%s]",Txt_Institution); if (Gbl.Hierarchy.Cty.CtyCod > 0) @@ -901,7 +902,8 @@ void Ins_WriteSelectorOfInstitution (void) /* Write option */ HTM_OPTION (HTM_Type_LONG,&InsCod, Gbl.Hierarchy.Ins.InsCod > 0 && - InsCod == Gbl.Hierarchy.Ins.InsCod,false, + InsCod == Gbl.Hierarchy.Ins.InsCod, // Selected? + false, // Not disabled "%s",row[1]); } diff --git a/swad_institution.h b/swad_institution.h index aa540d75..a15f192f 100644 --- a/swad_institution.h +++ b/swad_institution.h @@ -64,7 +64,7 @@ typedef enum struct ListInstits { unsigned Num; // Number of institutions - struct Ins_Instit *Lst; // List of institutions + struct Ins_Instit *Lst; // List of institutions Ins_Order_t SelectedOrder; // Order of institutions }; diff --git a/swad_institution_config.c b/swad_institution_config.c index 30c2ad01..74b13245 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -309,6 +309,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm) extern const char *Par_CodeStr[]; extern const char *Txt_Country; unsigned NumCty; + const struct Cty_Countr *CtyInLst; /***** Get list of countries *****/ Cty_GetBasicListOfCountries (); @@ -334,9 +335,13 @@ static void InsCfg_Country (bool PrintView,bool PutForm) for (NumCty = 0; NumCty < Gbl.Hierarchy.Ctys.Num; NumCty++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod, - Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod,false, - "%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + { + CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; + HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, + CtyInLst->CtyCod == Gbl.Hierarchy.Cty.CtyCod, // Selected? + false, // Not disabled + "%s",CtyInLst->Name[Gbl.Prefs.Language]); + } HTM_SELECT_End (); Frm_EndForm (); } diff --git a/swad_language.c b/swad_language.c index ab1fcfe9..f8fdbde1 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,false, + Lan == Gbl.Prefs.Language, // Selected? + false, // Not disabled "%s",Txt_STR_LANG_NAME[Lan]); } HTM_SELECT_End (); diff --git a/swad_message.c b/swad_message.c index bd8fe131..741b302b 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1822,7 +1822,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,false, + Messages->FilterCrsCod < 0, // Selected? + false, // Not disabled "%s",Txt_any_course); /* Write an option for each origin course */ @@ -1835,7 +1836,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,false, + CrsCod == Messages->FilterCrsCod, // Selected? + false, // Not disabled "%s",row[1]); // Course short name } diff --git a/swad_photo.c b/swad_photo.c index 3e9349e1..c22ab2ab 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,false, + TypeOfAvg == DegPhotos->TypeOfAverage, // Selected? + false, // Not disabled "%s",Txt_AVERAGE_PHOTO_TYPES[TypeOfAvg]); } HTM_SELECT_End (); @@ -1867,7 +1868,8 @@ static void Pho_PutSelectorForHowComputePhotoSize (const struct Pho_DegPhotos *D { PhoSiUnsigned = (unsigned) PhoSi; HTM_OPTION (HTM_Type_UNSIGNED,&PhoSiUnsigned, - PhoSi == DegPhotos->HowComputePhotoSize,false, + PhoSi == DegPhotos->HowComputePhotoSize, // Selected? + false, // Not disabled "%s",Txt_STAT_DEGREE_PHOTO_SIZE[PhoSi]); } HTM_SELECT_End (); @@ -1931,7 +1933,8 @@ static void Pho_PutSelectorForHowOrderDegrees (const struct Pho_DegPhotos *DegPh { OrderUnsigned = (unsigned) Order; HTM_OPTION (HTM_Type_UNSIGNED,&OrderUnsigned, - Order == DegPhotos->HowOrderDegrees,false, + Order == DegPhotos->HowOrderDegrees, // Selected? + false, // Not disabled "%s",Txt_STAT_DEGREE_PHOTO_ORDER[Order]); } HTM_SELECT_End (); @@ -2047,7 +2050,9 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh // Too recently computed ? Disabled = Pho_GetTimeAvgPhotoWasComputed (Degs.Lst[NumDeg].DegCod) >= Dat_GetStartExecutionTimeUTC () - Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO; - HTM_OPTION (HTM_Type_LONG,&Degs.Lst[NumDeg].DegCod,Selected,Disabled, + HTM_OPTION (HTM_Type_LONG,&Degs.Lst[NumDeg].DegCod, + Selected, + Disabled, "%s (%s: %s)", Degs.Lst[NumDeg].ShrtName, Txt_time,StrEstimatedTimeToComputeAvgPhoto); diff --git a/swad_place.c b/swad_place.c index e9576739..a806f9f2 100644 --- a/swad_place.c +++ b/swad_place.c @@ -547,7 +547,7 @@ void Plc_RemovePlace (void) /***** Get place code *****/ Plc_EditingPlc->PlcCod = ParCod_GetAndCheckPar (ParCod_Plc); - /***** Get data of the place from database *****/ + /***** Get place data from database *****/ Plc_GetPlaceDataByCod (Plc_EditingPlc); /***** Check if this place has centers *****/ @@ -630,7 +630,7 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName) /* Get the new name for the place */ Par_GetParText (ParName,NewPlcName,MaxBytes); - /***** Get from the database the old names of the place *****/ + /***** Get place old names from database *****/ Plc_GetPlaceDataByCod (Plc_EditingPlc); /***** Check if new name is empty *****/ diff --git a/swad_project.c b/swad_project.c index 1246d37b..2d069886 100644 --- a/swad_project.c +++ b/swad_project.c @@ -345,7 +345,7 @@ void Prj_ResetPrjsAndReadConfig (struct Prj_Projects *Projects) Projects->Prj.PrjCod = -1L; /***** Read project configuration from database *****/ - PrjCfg_GetConfig (Projects); + PrjCfg_GetConfig (&Projects->Config); } /*****************************************************************************/ @@ -1852,7 +1852,8 @@ static void Prj_PutSelectorReviewStatus (struct Prj_Projects *Projects) { ReviewStatusUnsigned = (unsigned) ReviewStatus; HTM_OPTION (HTM_Type_UNSIGNED,&ReviewStatusUnsigned, - ReviewStatus == Projects->Prj.Review.Status,false, + ReviewStatus == Projects->Prj.Review.Status, // Selected? + false, // Not disabled "%s",Txt_PROJECT_REVIEW_SINGUL[ReviewStatus]); } HTM_SELECT_End (); @@ -3839,9 +3840,13 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects, HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, "name=\"Assigned\" class=\"INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"Y",Projects->Prj.Assigned == Prj_ASSIGNED,false, + HTM_OPTION (HTM_Type_STRING,"Y", + Projects->Prj.Assigned == Prj_ASSIGNED, // Selected? + false, // Not disabled "%s",Txt_Yes); - HTM_OPTION (HTM_Type_STRING,"N",Projects->Prj.Assigned == Prj_NONASSIG,false, + HTM_OPTION (HTM_Type_STRING,"N", + Projects->Prj.Assigned == Prj_NONASSIG, // Selected? + false, // Not disabled "%s",Txt_No); HTM_SELECT_End (); HTM_TD_End (); @@ -3882,7 +3887,8 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects, { ProposalUnsigned = (unsigned) Proposal; HTM_OPTION (HTM_Type_UNSIGNED,&ProposalUnsigned, - Projects->Prj.Proposal == Proposal,false, + Projects->Prj.Proposal == Proposal, // Selected? + false, // Not disabled "%s",Txt_PROJECT_STATUS[Proposal]); } HTM_SELECT_End (); diff --git a/swad_project.h b/swad_project.h index a073c947..7d8cf3a1 100644 --- a/swad_project.h +++ b/swad_project.h @@ -30,6 +30,7 @@ #include "swad_browser.h" #include "swad_date.h" #include "swad_notification.h" +#include "swad_project_config.h" #include "swad_user.h" /*****************************************************************************/ @@ -185,10 +186,7 @@ struct Prj_Project struct Prj_Projects { Prj_ProjectView_t View; - struct - { - bool NETCanCreate; - } Config; + struct PrjCfg_Config Config; struct Prj_Filter Filter; bool LstIsRead; // Is the list already read from database, or it needs to be read? unsigned Num; // Number of projects diff --git a/swad_project_config.c b/swad_project_config.c index 00555024..1e8eb079 100644 --- a/swad_project_config.c +++ b/swad_project_config.c @@ -59,34 +59,42 @@ extern struct Globals Gbl; /************************* Private global variables **************************/ /*****************************************************************************/ -static struct Rub_Rubric PrjCfg_Rubrics[PrjCfg_NUM_RUBRICS]; +// static struct Rub_Rubric PrjCfg_Rubrics[PrjCfg_NUM_RUBRICS]; /*****************************************************************************/ /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects); -static void PrjCfg_ShowFormRubrics (void); -static void PrjCfg_ShowFormRubric (struct Rub_Rubrics *Rubrics, +static void PrjCfg_ShowFormNETCanCreate (const struct PrjCfg_Config *Config); +static void PrjCfg_ShowFormRubrics (const struct PrjCfg_Config *Config); +static void PrjCfg_ShowFormRubric (const struct PrjCfg_Config *Config, + const struct Rub_Rubrics *Rubrics, PrjCfg_Rubric_t WhichRubric); static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res, - struct Prj_Projects *Projects); + struct PrjCfg_Config *Config); static bool PrjCfg_GetIfNETCanCreateFromForm (void); /*****************************************************************************/ /************** Get configuration of projects for current course *************/ /*****************************************************************************/ -void PrjCfg_GetConfig (struct Prj_Projects *Projects) +void PrjCfg_GetConfig (struct PrjCfg_Config *Config) { MYSQL_RES *mysql_res; + PrjCfg_Rubric_t WhichRubric; /***** Get configuration of projects for current course from database *****/ if (Prj_DB_GetConfig (&mysql_res)) - PrjCfg_GetConfigDataFromRow (mysql_res,Projects); + PrjCfg_GetConfigDataFromRow (mysql_res,Config); else - Projects->Config.NETCanCreate = PrjCfg_NET_CAN_CREATE_DEFAULT; + { + for (WhichRubric = (PrjCfg_Rubric_t) 0; + WhichRubric <= (PrjCfg_Rubric_t) (PrjCfg_NUM_RUBRICS - 1); + WhichRubric++) + Config->RubCod[WhichRubric] = -1L; + Config->NETCanCreate = PrjCfg_NET_CAN_CREATE_DEFAULT; + } /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -132,10 +140,10 @@ void PrjCfg_ShowFormConfig (void) HTM_TABLE_BeginCenterPadding (2); /***** Projects are editable by non-editing teachers? *****/ - PrjCfg_ShowFormNETCanCreate (&Projects); + PrjCfg_ShowFormNETCanCreate (&Projects.Config); /***** Rubrics *****/ - PrjCfg_ShowFormRubrics (); + PrjCfg_ShowFormRubrics (&Projects.Config); HTM_TABLE_End (); @@ -149,43 +157,11 @@ void PrjCfg_ShowFormConfig (void) Box_BoxEnd (); } -/*****************************************************************************/ -/****** Show form to edit if non-editing teachers create new projects ********/ -/*****************************************************************************/ - -static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects) - { - extern const char *Txt_Create_project; - extern const char *Txt_Non_editing_teachers_can_create_new_projects; - - HTM_TR_Begin (NULL); - - /***** Label *****/ - HTM_TD_Begin ("class=\"RM FORM_IN_%s\"", - The_GetSuffix ()); - HTM_TxtColon (Txt_Create_project); - HTM_TD_End (); - - /***** Data *****/ - HTM_TD_Begin ("class=\"LM\""); - HTM_LABEL_Begin ("class=\"DAT_%s\"", - The_GetSuffix ()); - HTM_INPUT_CHECKBOX ("NETCanCreate",HTM_DONT_SUBMIT_ON_CHANGE, - "id=\"NETCanCreate\" value=\"Y\"%s", - Projects->Config.NETCanCreate ? " checked=\"checked\"" : - ""); - HTM_Txt (Txt_Non_editing_teachers_can_create_new_projects); - HTM_LABEL_End (); - HTM_TD_End (); - - HTM_TR_End (); - } - /*****************************************************************************/ /************ Show form to edit rubrics associated to projects ***************/ /*****************************************************************************/ -static void PrjCfg_ShowFormRubrics (void) +static void PrjCfg_ShowFormRubrics (const struct PrjCfg_Config *Config) { struct Rub_Rubrics Rubrics; PrjCfg_Rubric_t WhichRubric; @@ -200,43 +176,59 @@ static void PrjCfg_ShowFormRubrics (void) for (WhichRubric = (PrjCfg_Rubric_t) 0; WhichRubric <= (PrjCfg_Rubric_t) (PrjCfg_NUM_RUBRICS - 1); WhichRubric++) - PrjCfg_ShowFormRubric (&Rubrics,WhichRubric); + PrjCfg_ShowFormRubric (Config,&Rubrics,WhichRubric); /***** Free list of rubrics *****/ Rub_FreeListRubrics (&Rubrics); } /*****************************************************************************/ -/************ Show form to edit rubrics associated to projects ***************/ +/******** Show form to edit one of the rubrics associated to projects ********/ /*****************************************************************************/ -static void PrjCfg_ShowFormRubric (struct Rub_Rubrics *Rubrics, +static void PrjCfg_ShowFormRubric (const struct PrjCfg_Config *Config, + const struct Rub_Rubrics *Rubrics, PrjCfg_Rubric_t WhichRubric) { extern const char *Txt_PROJECT_RUBRIC[PrjCfg_NUM_RUBRICS]; + extern const char *Txt_no_rubric; unsigned NumRub; + const struct Rub_Rubric *Rubric; + long RubCodInConfig = Config->RubCod[WhichRubric]; /***** Row with form for rubric *****/ HTM_TR_Begin (NULL); /* Label */ - HTM_TD_Begin ("class=\"RM FORM_IN_%s\"", - The_GetSuffix ()); + HTM_TD_Begin ("class=\"RM FORM_IN_%s\"",The_GetSuffix ()); HTM_TxtColon (Txt_PROJECT_RUBRIC[WhichRubric]); HTM_TD_End (); - /* Data */ + /* Selector of rubrics */ HTM_TD_Begin ("class=\"LM\""); HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, "id=\"%s\" name=\"%s\" class=\"PrjCfg_RUBRIC_SEL\"", PrjCfg_RubricIDs[WhichRubric], PrjCfg_RubricIDs[WhichRubric]); + + /* First option to indicate that no rubric is selected */ + HTM_OPTION (HTM_Type_STRING,"-1", + RubCodInConfig <= 0, // Selected? + false, // Not disabled + "[%s]",Txt_no_rubric); + + /* One option for each rubric in this course */ for (NumRub = 0; NumRub < Rubrics->Num; NumRub++) - HTM_OPTION (HTM_Type_LONG,&Rubrics->Lst[NumRub].RubCod, - Rubrics->Lst[NumRub].RubCod == PrjCfg_Rubrics[WhichRubric].RubCod,false, - "%s",Rubrics->Lst[NumRub].Title); + { + Rubric = &Rubrics->Lst[NumRub]; + HTM_OPTION (HTM_Type_LONG,&Rubric->RubCod, + Rubric->RubCod == RubCodInConfig, // Selected? + false, // Not disabled + "%s",Rubric->Title); + } + HTM_SELECT_End (); HTM_TD_End (); @@ -248,15 +240,57 @@ static void PrjCfg_ShowFormRubric (struct Rub_Rubrics *Rubrics, /*****************************************************************************/ static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res, - struct Prj_Projects *Projects) + struct PrjCfg_Config *Config) { MYSQL_ROW row; + PrjCfg_Rubric_t WhichRubric; /***** Get row *****/ row = mysql_fetch_row (mysql_res); + /* + row[0] RubTutCod + row[1] RubEvlCod + row[2] RubGblCod + row[3] NETCanCreate + */ + /***** Get rubric codes (row[0], row[1], row[2] *****/ + for (WhichRubric = (PrjCfg_Rubric_t) 0; + WhichRubric <= (PrjCfg_Rubric_t) (PrjCfg_NUM_RUBRICS - 1); + WhichRubric++) + Config->RubCod[WhichRubric] = Str_ConvertStrCodToLongCod (row[WhichRubric]); - /***** Get whether non-editing teachers can create new projects or not *****/ - Projects->Config.NETCanCreate = (row[0][0] == 'Y'); + /***** Get whether non-editing teachers can create new projects or not (row[3]) *****/ + Config->NETCanCreate = (row[3][0] == 'Y'); + } + +/*****************************************************************************/ +/****** Show form to edit if non-editing teachers create new projects ********/ +/*****************************************************************************/ + +static void PrjCfg_ShowFormNETCanCreate (const struct PrjCfg_Config *Config) + { + extern const char *Txt_Create_project; + extern const char *Txt_Non_editing_teachers_can_create_new_projects; + + HTM_TR_Begin (NULL); + + /***** Label *****/ + HTM_TD_Begin ("class=\"RM FORM_IN_%s\"",The_GetSuffix ()); + HTM_TxtColon (Txt_Create_project); + HTM_TD_End (); + + /***** Data *****/ + HTM_TD_Begin ("class=\"LM\""); + HTM_LABEL_Begin ("class=\"DAT_%s\"",The_GetSuffix ()); + HTM_INPUT_CHECKBOX ("NETCanCreate",HTM_DONT_SUBMIT_ON_CHANGE, + "id=\"NETCanCreate\" value=\"Y\"%s", + Config->NETCanCreate ? " checked=\"checked\"" : + ""); + HTM_Txt (Txt_Non_editing_teachers_can_create_new_projects); + HTM_LABEL_End (); + HTM_TD_End (); + + HTM_TR_End (); } /*****************************************************************************/ @@ -267,15 +301,22 @@ void PrjCfg_ReceiveConfig (void) { extern const char *Txt_The_configuration_of_the_projects_has_been_updated; struct Prj_Projects Projects; + PrjCfg_Rubric_t WhichRubric; /***** Reset projects *****/ Prj_ResetPrjsAndReadConfig (&Projects); + /***** Get rubric codes *****/ + for (WhichRubric = (PrjCfg_Rubric_t) 0; + WhichRubric <= (PrjCfg_Rubric_t) (PrjCfg_NUM_RUBRICS - 1); + WhichRubric++) + Projects.Config.RubCod[WhichRubric] = Par_GetParLong (PrjCfg_RubricIDs[WhichRubric]); + /***** Get non-editing teachers can create new projects or not *****/ Projects.Config.NETCanCreate = PrjCfg_GetIfNETCanCreateFromForm (); /***** Update database *****/ - Prj_DB_UpdateCrsPrjsConfig (Projects.Config.NETCanCreate); + Prj_DB_UpdateConfig (&Projects); /***** Show confirmation message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_configuration_of_the_projects_has_been_updated); diff --git a/swad_project_config.h b/swad_project_config.h index 120b8b8e..c9290455 100644 --- a/swad_project_config.h +++ b/swad_project_config.h @@ -27,6 +27,8 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include "swad_project.h" + /*****************************************************************************/ /************************** Public types and constants ***********************/ /*****************************************************************************/ @@ -41,11 +43,17 @@ typedef enum PrjCfg_RUBRIC_GBL, } PrjCfg_Rubric_t; +struct PrjCfg_Config + { + long RubCod[PrjCfg_NUM_RUBRICS]; + bool NETCanCreate; + }; + /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void PrjCfg_GetConfig (struct Prj_Projects *Projects); +void PrjCfg_GetConfig (struct PrjCfg_Config *Config); bool PrjCfg_CheckIfICanConfig (void); void PrjCfg_ShowFormConfig (void); diff --git a/swad_project_database.c b/swad_project_database.c index fab42c49..01f392d6 100644 --- a/swad_project_database.c +++ b/swad_project_database.c @@ -60,22 +60,6 @@ const char *Prj_ReviewStatus_DB[Prj_NUM_REVIEW_STATUS] = [Prj_APPROVED ] = "approved", }; -/*****************************************************************************/ -/************ Update configuration of projects for current course ************/ -/*****************************************************************************/ - -void Prj_DB_UpdateCrsPrjsConfig (bool Editable) - { - DB_QueryREPLACE ("can not save configuration of projects", - "REPLACE INTO prj_config" - " (CrsCod,Editable)" - " VALUES" - " (%ld,'%c')", - Gbl.Hierarchy.Crs.CrsCod, - Editable ? 'Y' : - 'N'); - } - /*****************************************************************************/ /**************************** Lock project edition ***************************/ /*****************************************************************************/ @@ -547,20 +531,6 @@ unsigned Prj_DB_GetListProjects (MYSQL_RES **mysql_res, return NumPrjsFromDB; } -/*****************************************************************************/ -/************** Get configuration of projects for current course *************/ -/*****************************************************************************/ - -unsigned Prj_DB_GetConfig (MYSQL_RES **mysql_res) - { - return (unsigned) - DB_QuerySELECT (mysql_res,"can not get project configuration", - "SELECT Editable" // row[0] - " FROM prj_config" - " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.CrsCod); - } - /*****************************************************************************/ /********************* Get project data using its code ***********************/ /*****************************************************************************/ @@ -957,3 +927,39 @@ void Prj_DB_RemoveCrsPrjs (long CrsCod) " WHERE CrsCod=%ld", CrsCod); } + +/*****************************************************************************/ +/************ Update configuration of projects for current course ************/ +/*****************************************************************************/ + +void Prj_DB_UpdateConfig (const struct Prj_Projects *Projects) + { + DB_QueryREPLACE ("can not save configuration of projects", + "REPLACE INTO prj_config" + " (CrsCod,RubTutCod,RubEvlCod,RubGblCod,NETCanCreate)" + " VALUES" + " (%ld,%ld,%ld,%ld,'%c')", + Gbl.Hierarchy.Crs.CrsCod, + Projects->Config.RubCod[PrjCfg_RUBRIC_TUT], + Projects->Config.RubCod[PrjCfg_RUBRIC_EVL], + Projects->Config.RubCod[PrjCfg_RUBRIC_GBL], + Projects->Config.NETCanCreate ? 'Y' : + 'N'); + } + +/*****************************************************************************/ +/************** Get configuration of projects for current course *************/ +/*****************************************************************************/ + +unsigned Prj_DB_GetConfig (MYSQL_RES **mysql_res) + { + return (unsigned) + DB_QuerySELECT (mysql_res,"can not get project configuration", + "SELECT RubTutCod," // row[0] + "RubEvlCod," // row[1] + "RubGblCod," // row[2] + "NETCanCreate" // row[3] + " FROM prj_config" + " WHERE CrsCod=%ld", + Gbl.Hierarchy.Crs.CrsCod); + } diff --git a/swad_project_database.h b/swad_project_database.h index 782753aa..538e9130 100644 --- a/swad_project_database.h +++ b/swad_project_database.h @@ -33,8 +33,6 @@ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void Prj_DB_UpdateCrsPrjsConfig (bool Editable); - void Prj_DB_LockProjectEdition (long PrjCod); void Prj_DB_UnlockProjectEdition (long PrjCod); long Prj_DB_CreateProject (const struct Prj_Project *Prj); @@ -46,7 +44,6 @@ void Prj_DB_UpdateReview (const struct Prj_Project *Prj); unsigned Prj_DB_GetListProjects (MYSQL_RES **mysql_res, const struct Prj_Projects *Projects, const char *UsrsSubQuery); // NULL if no users -unsigned Prj_DB_GetConfig (MYSQL_RES **mysql_res); unsigned Prj_DB_GetProjectDataByCod (MYSQL_RES **mysql_res,long PrjCod); void Prj_DB_GetProjectTitle (long PrjCod,char *Title,size_t TitleSize); unsigned Prj_DB_GetPrjDataToCheckFaults (MYSQL_RES **mysql_res,long PrjCod); @@ -66,4 +63,9 @@ void Prj_DB_RemoveConfigOfCrsPrjs (long CrsCod); void Prj_DB_RemovePrj (long PrjCod); void Prj_DB_RemoveCrsPrjs (long CrsCod); +//----------------------------- Configuration --------------------------------- + +void Prj_DB_UpdateConfig (const struct Prj_Projects *Projects); +unsigned Prj_DB_GetConfig (MYSQL_RES **mysql_res); + #endif diff --git a/swad_question.c b/swad_question.c index 87ec761a..8a999b47 100644 --- a/swad_question.c +++ b/swad_question.c @@ -1927,7 +1927,10 @@ void Qst_PutFormEditOneQst (struct Qst_Question *Question) IndTag,IndTag, The_GetSuffix ()); free (FuncOnChange); - HTM_OPTION (HTM_Type_STRING,"",false,false," "); + HTM_OPTION (HTM_Type_STRING,"", + false, // Not selected + false, // Not disabled + " "); mysql_data_seek (mysql_res,0); TagFound = false; for (NumTag = 1; @@ -1948,16 +1951,19 @@ void Qst_PutFormEditOneQst (struct Qst_Question *Question) TagFound = true; } HTM_OPTION (HTM_Type_STRING,row[1], - IsThisTag,false, + IsThisTag, // Selected? + false, // Not disabled "%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,false, + true, // Selected + false, // Not disabled "%s",Question->Tags.Txt[IndTag]); HTM_OPTION (HTM_Type_STRING,"", - false,false, + false, // Selected + false, // Not disabled "[%s]",Txt_new_tag); HTM_SELECT_End (); HTM_TD_End (); diff --git a/swad_record.c b/swad_record.c index 77250f35..423a9c0d 100644 --- a/swad_record.c +++ b/swad_record.c @@ -267,6 +267,7 @@ void Rec_ListFieldsRecordsForEdition (void) { extern const char *Txt_RECORD_FIELD_VISIBILITY_MENU[Rec_NUM_TYPES_VISIBILITY]; unsigned NumField; + struct RecordField *FldInLst; Rec_VisibilityRecordFields_t Vis; unsigned VisUnsigned; char StrNumLines[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; @@ -279,18 +280,20 @@ void Rec_ListFieldsRecordsForEdition (void) NumField < Gbl.Crs.Records.LstFields.Num; NumField++) { + FldInLst = &Gbl.Crs.Records.LstFields.Lst[NumField]; + HTM_TR_Begin (NULL); /* Write icon to remove the field */ HTM_TD_Begin ("class=\"BM\""); Ico_PutContextualIconToRemove (ActReqRemFie,NULL, - Rec_PutParFldCod,&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); + Rec_PutParFldCod,&FldInLst->FieldCod); HTM_TD_End (); /* Name of the field */ HTM_TD_Begin ("class=\"LM\""); Frm_BeginForm (ActRenFie); - ParCod_PutPar (ParCod_Fld,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); + ParCod_PutPar (ParCod_Fld,FldInLst->FieldCod); HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD, Gbl.Crs.Records.LstFields.Lst[NumField].Name, HTM_SUBMIT_ON_CHANGE, @@ -302,9 +305,9 @@ void Rec_ListFieldsRecordsForEdition (void) /* Number of lines in the form */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgRowFie); - ParCod_PutPar (ParCod_Fld,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); + ParCod_PutPar (ParCod_Fld,FldInLst->FieldCod); snprintf (StrNumLines,sizeof (StrNumLines),"%u", - Gbl.Crs.Records.LstFields.Lst[NumField].NumLines); + FldInLst->NumLines); HTM_INPUT_TEXT ("NumLines",Cns_MAX_DECIMAL_DIGITS_UINT,StrNumLines, HTM_SUBMIT_ON_CHANGE, "size=\"2\" class=\"INPUT_%s\"", @@ -315,7 +318,7 @@ void Rec_ListFieldsRecordsForEdition (void) /* Visibility of a field */ HTM_TD_Begin ("class=\"CM\""); Frm_BeginForm (ActChgVisFie); - ParCod_PutPar (ParCod_Fld,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); + ParCod_PutPar (ParCod_Fld,FldInLst->FieldCod); HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, "name=\"Visibility\" class=\"INPUT_%s\"", The_GetSuffix ()); @@ -325,7 +328,8 @@ void Rec_ListFieldsRecordsForEdition (void) { VisUnsigned = (unsigned) Vis; HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned, - Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Vis,false, + Vis == FldInLst->Visibility, // Selected? + false, // Not disabled "%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } HTM_SELECT_End (); @@ -399,7 +403,8 @@ void Rec_ShowFormCreateRecordField (void) { VisUnsigned = (unsigned) Vis; HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned, - Gbl.Crs.Records.Field.Visibility == Vis,false, + Vis == Gbl.Crs.Records.Field.Visibility, // Selected? + false, // Not disabled "%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]); } HTM_SELECT_End (); @@ -1411,7 +1416,8 @@ static void Rec_ShowLinkToPrintPreviewOfRecords (void) i <= Rec_MAX_RECORDS_PER_PAGE; i++) HTM_OPTION (HTM_Type_UNSIGNED,&i, - i == Gbl.Usrs.Listing.RecsPerPag,false, + i == Gbl.Usrs.Listing.RecsPerPag, // Selected? + false, // Not disabled "%u",i); HTM_SELECT_End (); HTM_TxtF (" %s)",Txt_record_cards_per_page); @@ -2807,7 +2813,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm,false, + Role == DefaultRoleInForm, // Selected? + false, // Not disabled "%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); } HTM_SELECT_End (); @@ -2872,7 +2879,9 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, case Rol_STD: case Rol_NET: RoleUnsigned = (unsigned) Gbl.Usrs.Me.Role.Logged; - HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,true,true, + HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, + true, // Selected + true, // Disabled "%s",Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][UsrDat->Sex]); break; case Rol_TCH: @@ -2886,7 +2895,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm,false, + Role == DefaultRoleInForm, // Selected? + false, // Not disabled "%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); } break; @@ -2909,7 +2919,9 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, " class=\"INPUT_%s\"", The_GetSuffix ()); RoleUnsigned = (unsigned) DefaultRoleInForm; - HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,true,true, + HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, + true, // Selected + true, // Disabled "%s",Txt_ROLES_SINGUL_Abc[DefaultRoleInForm][UsrDat->Sex]); HTM_SELECT_End (); } @@ -2951,7 +2963,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, { RoleUnsigned = (unsigned) Role; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - Role == DefaultRoleInForm,false, + Role == DefaultRoleInForm, // Selected? + false, // Not disabled "%s",Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]); } HTM_SELECT_End (); @@ -2970,7 +2983,8 @@ static void Rec_ShowRole (struct Usr_Data *UsrDat, The_GetSuffix ()); RoleUnsigned = (unsigned) Rol_GST; HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned, - true,false, + true, // Selected + false, // Not disabled "%s",Txt_ROLES_SINGUL_Abc[Rol_GST][Usr_SEX_UNKNOWN]); HTM_SELECT_End (); break; @@ -3158,6 +3172,7 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm) extern const char *Txt_Another_country; char *Label; unsigned NumCty; + const struct Cty_Countr *CtyInLst; /***** If list of countries is empty, try to get it *****/ Cty_GetBasicListOfCountries (); @@ -3183,16 +3198,24 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm) " class=\"REC_C2_BOT_INPUT INPUT_%s\"" " required=\"required\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"",false,false, + HTM_OPTION (HTM_Type_STRING,"", + false, // Not selected + false, // Not disabled "%s",Txt_Country); - HTM_OPTION (HTM_Type_STRING,"0",UsrDat->CtyCod == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + UsrDat->CtyCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_country); for (NumCty = 0; NumCty < Gbl.Hierarchy.Ctys.Num; NumCty++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod, - Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod,false, - "%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + { + CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; + HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, + CtyInLst->CtyCod == UsrDat->CtyCod, // Selected? + false, // Not disabled + "%s",CtyInLst->Name[Gbl.Prefs.Language]); + } HTM_SELECT_End (); HTM_TD_End (); @@ -3767,8 +3790,11 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) extern const char *Txt_Office; extern const char *Txt_Phone; unsigned NumCty; + const struct Cty_Countr *CtyInLst; unsigned NumIns; + const struct Ins_Instit *InsInLst; unsigned NumCtr; + const struct Ctr_Center *CtrInLst; char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char *Label; char *SelectClass; @@ -3806,14 +3832,19 @@ 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,true, + Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0, // Selected? + true, // Disabled NULL); for (NumCty = 0; NumCty < Gbl.Hierarchy.Ctys.Num; NumCty++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod, - Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod,false, - "%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + { + CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; + HTM_OPTION (HTM_Type_LONG,&CtyInLst->CtyCod, + CtyInLst->CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod, // Selected? + false, // Not disabled + "%s",CtyInLst->Name[Gbl.Prefs.Language]); + } HTM_SELECT_End (); Frm_EndForm (); @@ -3845,17 +3876,23 @@ 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,true, + Gbl.Usrs.Me.UsrDat.InsCod < 0, // Selected? + true, // Disabled NULL); HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Usrs.Me.UsrDat.InsCod == 0,false, + Gbl.Usrs.Me.UsrDat.InsCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_institution); for (NumIns = 0; NumIns < Gbl.Hierarchy.Inss.Num; NumIns++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod, - Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod,false, - "%s",Gbl.Hierarchy.Inss.Lst[NumIns].FullName); + { + InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns]; + HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod, + InsInLst->InsCod == Gbl.Usrs.Me.UsrDat.InsCod, // Selected? + false, // Not disabled + "%s",InsInLst->FullName); + } HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); @@ -3888,17 +3925,23 @@ 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,true, + Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0, // Selected? + true, // Disabled NULL); HTM_OPTION (HTM_Type_STRING,"0", - Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0,false, + Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0, // Selected? + false, // Not disabled Txt_Another_center); for (NumCtr = 0; NumCtr < Gbl.Hierarchy.Ctrs.Num; NumCtr++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod, - Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod,false, - Gbl.Hierarchy.Ctrs.Lst[NumCtr].FullName); + { + CtrInLst = &Gbl.Hierarchy.Ctrs.Lst[NumCtr]; + HTM_OPTION (HTM_Type_LONG,&CtrInLst->CtrCod, + CtrInLst->CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod, // Selected? + false, // Not disabled + CtrInLst->FullName); + } HTM_SELECT_End (); Frm_EndForm (); HTM_TD_End (); diff --git a/swad_role.c b/swad_role.c index d667497d..99e43c9f 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,false, + Role == Gbl.Usrs.Me.Role.Logged, // Selected? + false, // Not disabled "%s",Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]); } HTM_SELECT_End (); diff --git a/swad_room.c b/swad_room.c index 815210db..891a1117 100644 --- a/swad_room.c +++ b/swad_room.c @@ -781,6 +781,7 @@ static void Roo_PutSelectorBuilding (long BldCod, extern const char *Txt_No_assigned_building; extern const char *Txt_Another_building; unsigned NumBld; + const struct Bld_Building *BldInLst; /***** Begin selector *****/ HTM_SELECT_Begin (SubmitOnChange,NULL, @@ -789,21 +790,27 @@ static void Roo_PutSelectorBuilding (long BldCod, /***** Option for no assigned building *****/ HTM_OPTION (HTM_Type_STRING,"-1", - BldCod < 0,false, + BldCod < 0, // Selected? + false, // Not disabled "%s",Txt_No_assigned_building); /***** Option for another room *****/ HTM_OPTION (HTM_Type_STRING,"0", - BldCod == 0,false, + BldCod == 0, // Selected? + false, // Not disabled "%s",Txt_Another_building); /***** Options for buildings *****/ for (NumBld = 0; NumBld < Buildings->Num; NumBld++) - HTM_OPTION (HTM_Type_LONG,&Buildings->Lst[NumBld].BldCod, - BldCod == Buildings->Lst[NumBld].BldCod,false, - "%s",Buildings->Lst[NumBld].ShrtName); + { + BldInLst = &Buildings->Lst[NumBld]; + HTM_OPTION (HTM_Type_LONG,&BldInLst->BldCod, + BldCod == BldInLst->BldCod, // Selected? + false, // Not disabled + "%s",BldInLst->ShrtName); + } /***** End selector *****/ HTM_SELECT_End (); @@ -829,7 +836,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,false, + Type == RoomType, // Selected? + false, // Not disabled "%s",Txt_ROOM_TYPES[Type]); /***** End selector *****/ diff --git a/swad_scope.c b/swad_scope.c index 8fe70760..0d6c2bde 100644 --- a/swad_scope.c +++ b/swad_scope.c @@ -105,42 +105,48 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan { case HieLvl_SYS: HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%s: %s", Txt_System, Cfg_PLATFORM_SHORT_NAME); break; case HieLvl_CTY: HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%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,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%s: %s", Txt_Institution, Gbl.Hierarchy.Ins.ShrtName); break; case HieLvl_CTR: HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%s: %s", Txt_Center, Gbl.Hierarchy.Ctr.ShrtName); break; case HieLvl_DEG: HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%s: %s", Txt_Degree, Gbl.Hierarchy.Deg.ShrtName); break; case HieLvl_CRS: HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, - Gbl.Scope.Current == Scope,false, + Gbl.Scope.Current == Scope, // Selected? + false, // Not disabled "%s: %s", Txt_Course, Gbl.Hierarchy.Crs.ShrtName); diff --git a/swad_search.c b/swad_search.c index a5977645..f0902bf8 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, - Search->WhatToSearch == WhatToSearch,false, + WhatToSearch == Search->WhatToSearch, // Selected? + false, // Not disabled "%s",*Titles[WhatToSearch]); } HTM_SELECT_End (); diff --git a/swad_statistic.c b/swad_statistic.c index 63b6f3c0..b3a7d55e 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,false, + ClicksGroupedBy == Stats->ClicksGroupedBy, // Selected? + false, // Not disabled "%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } HTM_SELECT_End (); @@ -406,7 +407,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,false, + RowsPerPage[i] == Stats->RowsPerPage, // Selected? + false, // Not disabled "%u",RowsPerPage[i]); HTM_SELECT_End (); HTM_Txt (")"); @@ -517,7 +519,8 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats) { RoleStatUnsigned = (unsigned) RoleStat; HTM_OPTION (HTM_Type_UNSIGNED,&RoleStatUnsigned, - RoleStat == Stats->Role,false, + RoleStat == Stats->Role, // Selected? + false, // Not disabled "%s",Txt_ROLE_STATS[RoleStat]); } HTM_SELECT_End (); @@ -577,7 +580,8 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats) { ClicksGroupedByUnsigned = (unsigned) ClicksGroupedBy; HTM_OPTION (HTM_Type_UNSIGNED,&ClicksGroupedByUnsigned, - ClicksGroupedBy == Stats->ClicksGroupedBy,false, + ClicksGroupedBy == Stats->ClicksGroupedBy, // Selected? + false, // Not disabled "%s",Txt_STAT_CLICKS_GROUPED_BY[ClicksGroupedBy]); } HTM_SELECT_End (); @@ -657,7 +661,8 @@ static void Sta_WriteSelectorCountType (const struct Sta_Stats *Stats) { StatCountTypeUnsigned = (unsigned) StatCountType; HTM_OPTION (HTM_Type_UNSIGNED,&StatCountTypeUnsigned, - StatCountType == Stats->CountType,false, + StatCountType == Stats->CountType, // Selected? + false, // Not disabled "%s",Txt_STAT_TYPE_COUNT_SMALL[StatCountType]); } HTM_SELECT_End (); @@ -687,7 +692,9 @@ static void Sta_WriteSelectorAction (const struct Sta_Stats *Stats) "id=\"StatAct\" name=\"StatAct\"" " class=\"STAT_SEL INPUT_%s\"", The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"0",Stats->NumAction == 0,false, + HTM_OPTION (HTM_Type_STRING,"0", + Stats->NumAction == 0, // Selected? + false, // Not disabled "%s",Txt_Any_action); for (Action = (Act_Action_t) 1; Action <= (Act_Action_t) (ActLst_NUM_ACTIONS - 1); @@ -696,7 +703,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,false, + Action == Stats->NumAction, // Selected? + false, // Not disabled "%u: %s > %s", (unsigned) Action,Txt_TABS_TXT[Tab],Act_GetActionText (Action)); } @@ -1612,7 +1620,8 @@ static void Sta_ShowDistrAccessesPerDayAndHour (const struct Sta_Stats *Stats, { ColorTypeUnsigned = (unsigned) ColorType; HTM_OPTION (HTM_Type_UNSIGNED,&ColorTypeUnsigned, - ColorType == SelectedColorType,false, + ColorType == SelectedColorType, // Selected? + false, // Not selected "%s",Txt_STAT_COLOR_TYPES[ColorType]); } HTM_SELECT_End (); diff --git a/swad_test_print.c b/swad_test_print.c index 41befe6e..4848f85e 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -397,9 +397,18 @@ static void TstPrn_WriteTF_AnsToFill (const struct TstPrn_PrintedQuestion *Print HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, "name=\"Ans%010u\" class=\"INPUT_%s\"", QstInd,The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"" ,PrintedQuestion->StrAnswers[0] == '\0',false," "); - HTM_OPTION (HTM_Type_STRING,"T",PrintedQuestion->StrAnswers[0] == 'T' ,false,"%s",Txt_TF_QST[0]); - HTM_OPTION (HTM_Type_STRING,"F",PrintedQuestion->StrAnswers[0] == 'F' ,false,"%s",Txt_TF_QST[1]); + HTM_OPTION (HTM_Type_STRING,"" , + PrintedQuestion->StrAnswers[0] == '\0', // Selected? + false, // Not disabled + " "); + HTM_OPTION (HTM_Type_STRING,"T", + PrintedQuestion->StrAnswers[0] == 'T', // Selected? + false, // Not disabled + "%s",Txt_TF_QST[0]); + HTM_OPTION (HTM_Type_STRING,"F", + PrintedQuestion->StrAnswers[0] == 'F', // Selected? + false, // Not disabled + "%s",Txt_TF_QST[1]); HTM_SELECT_End (); } diff --git a/swad_text.c b/swad_text.c index db24cd30..dbc0154f 100644 --- a/swad_text.c +++ b/swad_text.c @@ -26974,6 +26974,28 @@ const char *Txt_No_results = #elif L==10 // tr "No results."; // Çeviri lazim! #endif +const char *Txt_no_rubric = +#if L==1 // ca + "sense rúbrica"; +#elif L==2 // de + "keine Rubrik"; +#elif L==3 // en + "no rubric"; +#elif L==4 // es + "sin rúbrica"; +#elif L==5 // fr + "pas de rubrique"; +#elif L==6 // gn + "ndaipóri rúbrica"; +#elif L==7 // it + "nessuna rubrica"; +#elif L==8 // pl + "bez rubryk"; +#elif L==9 // pt + "sem rubrica"; +#elif L==10 // tr + "değerlendirme listesi olmadan"; +#endif const char *Txt_No_rubrics = #if L==1 // ca @@ -26987,7 +27009,7 @@ const char *Txt_No_rubrics = #elif L==5 // fr "Pas de rubriques."; #elif L==6 // gn - "No hay rúbricas."; // Okoteve traducción + "Ndaipóri rúbrica."; #elif L==7 // it "Non ci sono rubriche."; #elif L==8 // pl diff --git a/swad_timetable.c b/swad_timetable.c index e3c92733..11bb3845 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1525,7 +1525,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,false, + CT == ClassType, // Selected? + false, // Not disabled "%s",Txt_TIMETABLE_CLASS_TYPES[CT]); HTM_SELECT_End (); @@ -1572,7 +1573,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,false, + Dur == DurationNumIntervals, // Selected? + false, // Not disabled "%s",TTDur); free (TTDur); } @@ -1597,7 +1599,9 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, " class=\"Tmt_GRP INPUT_%s\"", CellStr,Par_CodeStr[ParCod_Grp], The_GetSuffix ()); - HTM_OPTION (HTM_Type_STRING,"-1",GrpCod <= 0,false, + HTM_OPTION (HTM_Type_STRING,"-1", + GrpCod <= 0, // Selected? + false, // Not disabled "%s",Txt_All_groups); for (NumGrpTyp = 0; NumGrpTyp < Gbl.Crs.Grps.GrpTypes.NumGrpTypes; @@ -1621,7 +1625,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable, Err_NotEnoughMemoryExit (); } HTM_OPTION (HTM_Type_LONG,&Grp->GrpCod, - GrpCod == Grp->GrpCod,false, + GrpCod == Grp->GrpCod, // Selected? + false, // Not disabled "%s %s%s", GrpTyp->GrpTypName,Grp->GrpName,Room); free (Room); diff --git a/swad_user.c b/swad_user.c index 2e40183b..17a2822b 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,false, + Cols == Gbl.Usrs.ClassPhoto.Cols, // Selected? + false, // Not disabled "%u",Cols); /***** End selector *****/