From b79daa5c3e119e1d97d32e274732ea1f1fba6558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 26 Dec 2019 13:44:12 +0100 Subject: [PATCH] Version19.97.10 --- swad_centre.c | 90 +++++++++------------------------------------- swad_changelog.h | 3 +- swad_course.c | 64 ++++++--------------------------- swad_degree.c | 54 ++++++---------------------- swad_hierarchy.c | 20 +++++++++++ swad_hierarchy.h | 1 + swad_institution.c | 74 ++++++++------------------------------ 7 files changed, 73 insertions(+), 233 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index 501b70254..8bc959189 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -533,16 +533,11 @@ static void Ctr_ConfigMap (void) static void Ctr_ConfigLatitude (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Latitude; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"Latitude\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Latitude); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("Latitude",Txt_Latitude); HTM_TD_Begin ("class=\"LM\""); /* Form to change centre latitude */ @@ -561,16 +556,11 @@ static void Ctr_ConfigLatitude (void) static void Ctr_ConfigLongitude (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Longitude; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"Longitude\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Longitude); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("Longitude",Txt_Longitude); HTM_TD_Begin ("class=\"LM\""); /* Form to change centre longitude */ @@ -589,16 +579,11 @@ static void Ctr_ConfigLongitude (void) static void Ctr_ConfigAltitude (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Altitude; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"Altitude\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Altitude); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("Altitude",Txt_Altitude); HTM_TD_Begin ("class=\"LM\""); /* Form to change centre WWW */ @@ -699,18 +684,12 @@ static void Ctr_ConfigPhoto (bool PrintView,bool PutLink) static void Ctr_ConfigInstitution (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Institution; unsigned NumIns; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"OthInsCod\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Institution); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("OthInsCod",Txt_Institution); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -750,16 +729,11 @@ static void Ctr_ConfigInstitution (bool PrintView) static void Ctr_ConfigFullName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Centre; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"FullName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Centre); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("FullName",Txt_Centre); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -785,16 +759,11 @@ static void Ctr_ConfigFullName (bool PrintView) static void Ctr_ConfigShrtName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Short_name; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"ShortName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Short_name); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("ShortName",Txt_Short_name); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -820,7 +789,6 @@ static void Ctr_ConfigShrtName (bool PrintView) static void Ctr_ConfigPlace (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Place; extern const char *Txt_Another_place; struct Place Plc; @@ -830,9 +798,7 @@ static void Ctr_ConfigPlace (bool PrintView) Plc_GetDataOfPlaceByCod (&Plc); HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Place); - HTM_TD_End (); + Hie_ConfigLabel ("PlcCod",Txt_Place); HTM_TD_Begin ("class=\"DAT LM\""); if (!PrintView && @@ -876,17 +842,11 @@ static void Ctr_ConfigPlace (bool PrintView) static void Ctr_ConfigWWW (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Web; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"WWW\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Web); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("WWW",Txt_Web); HTM_TD_Begin ("class=\"LM\""); if (!PrintView && @@ -897,7 +857,7 @@ static void Ctr_ConfigWWW (bool PrintView) /* Form to change centre WWW */ Frm_StartForm (ActChgCtrWWWCfg); HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Ctr.WWW,true, - "class=\"INPUT_WWW_WIDE\" required=\"required\""); + "id=\"WWW\" class=\"INPUT_WWW_WIDE\" required=\"required\""); Frm_EndForm (); } else // I can not change centre WWW @@ -921,14 +881,11 @@ static void Ctr_ConfigWWW (bool PrintView) static void Ctr_ConfigShortcut (void) { extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Shortcut; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Shortcut); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Shortcut); HTM_TD_Begin ("class=\"DAT LM\""); HTM_A_Begin ("href=\"%s/%s?ctr=%ld\" class=\"DAT\" target=\"_blank\"", @@ -951,14 +908,11 @@ static void Ctr_ConfigShortcut (void) static void Ctr_ConfigQR (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_QR_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_QR_code); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_QR_code); HTM_TD_Begin ("class=\"DAT LM\""); QR_LinkTo (250,"ctr",Gbl.Hierarchy.Ctr.CtrCod); @@ -973,14 +927,11 @@ static void Ctr_ConfigQR (void) static void Ctr_ConfigNumUsrs (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Users_of_the_centre; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Users_of_the_centre); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Users_of_the_centre); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Usr_GetNumUsrsWhoClaimToBelongToCtr (Gbl.Hierarchy.Ctr.CtrCod)); @@ -995,15 +946,12 @@ static void Ctr_ConfigNumUsrs (void) static void Ctr_ConfigNumDegs (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Degrees; extern const char *Txt_Degrees_of_CENTRE_X; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Degrees); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Degrees); /* Form to go to see degrees of this centre */ HTM_TD_Begin ("class=\"LM\""); @@ -1027,14 +975,11 @@ static void Ctr_ConfigNumDegs (void) static void Ctr_ConfigNumCrss (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Courses; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Courses); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Courses); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Crs_GetNumCrssInCtr (Gbl.Hierarchy.Ctr.CtrCod)); @@ -1049,16 +994,13 @@ static void Ctr_ConfigNumCrss (void) static void Ctr_ShowNumUsrsInCrssOfCtr (Rol_Role_t Role) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Users_in_courses; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Role == Rol_UNK ? Txt_Users_in_courses : - Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Role == Rol_UNK ? Txt_Users_in_courses : + Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Usr_GetNumUsrsInCrssOfCtr (Role,Gbl.Hierarchy.Ctr.CtrCod)); diff --git a/swad_changelog.h b/swad_changelog.h index 21c5532a3..cd078caa3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.97.9 (2019-12-26)" +#define Log_PLATFORM_VERSION "SWAD 19.97.10 (2019-12-26)" #define CSS_FILE "swad19.97.css" #define JS_FILE "swad19.91.1.js" /* @@ -501,6 +501,7 @@ ps2pdf source.ps destination.pdf // TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué? Version 19.98: Dec 26, 2019 Map in institution information. (? lines) + Version 19.97.10: Dec 26, 2019 Code refactoring in course, degree, centre and institution information. (249394 lines) Version 19.97.9: Dec 26, 2019 Code refactoring in course information. (249557 lines) Version 19.97.8: Dec 26, 2019 Code refactoring in degree information. (249458 lines) Version 19.97.7: Dec 24, 2019 Code refactoring in institution information. (249383 lines) diff --git a/swad_course.c b/swad_course.c index 278aa2c35..c4ef9700c 100644 --- a/swad_course.c +++ b/swad_course.c @@ -288,18 +288,12 @@ static void Crs_ConfigTitle (bool PutLink) static void Crs_ConfigDegree (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Degree; unsigned NumDeg; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"OthDegCod\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Degree); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("OthDegCod",Txt_Degree); HTM_TD_Begin ("class=\"DAT LM\""); @@ -342,17 +336,11 @@ static void Crs_ConfigDegree (bool PrintView) static void Crs_ConfigFullName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Course; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"FullName\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Course); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("FullName",Txt_Course); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -379,18 +367,12 @@ static void Crs_ConfigFullName (bool PrintView) static void Crs_ConfigShrtName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Short_name; /***** Course short name *****/ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"ShortName\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Short_name); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("ShortName",Txt_Short_name); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -417,7 +399,6 @@ static void Crs_ConfigShrtName (bool PrintView) static void Crs_ConfigYear (bool IsForm) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_Not_applicable; @@ -425,11 +406,7 @@ static void Crs_ConfigYear (bool IsForm) HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"OthCrsYear\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Year_OF_A_DEGREE); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("OthCrsYear",Txt_Year_OF_A_DEGREE); HTM_TD_Begin ("class=\"DAT LM\""); if (IsForm) @@ -460,17 +437,11 @@ static void Crs_ConfigYear (bool IsForm) static void Crs_ConfigInstitutionalCode (bool IsForm) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Institutional_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"InsCrsCod\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Institutional_code); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("InsCrsCod",Txt_Institutional_code); HTM_TD_Begin ("class=\"DAT LM\""); if (IsForm) @@ -495,14 +466,11 @@ static void Crs_ConfigInstitutionalCode (bool IsForm) static void Crs_ConfigInternalCode (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Internal_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Internal_code); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Internal_code); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Long (Gbl.Hierarchy.Crs.CrsCod); @@ -518,14 +486,11 @@ static void Crs_ConfigInternalCode (void) static void Crs_ConfigShortcut (void) { extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Shortcut; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Shortcut); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Shortcut); HTM_TD_Begin ("class=\"DAT LM\""); HTM_A_Begin ("href=\"%s/%s?crs=%ld\" class=\"DAT\" target=\"_blank\"", @@ -548,14 +513,11 @@ static void Crs_ConfigShortcut (void) static void Crs_ConfigQR (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_QR_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_QR_code); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_QR_code); HTM_TD_Begin ("class=\"DAT LM\""); QR_LinkTo (250,"crs",Gbl.Hierarchy.Crs.CrsCod); @@ -570,14 +532,11 @@ static void Crs_ConfigQR (void) static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Gbl.Hierarchy.Crs.NumUsrs[Role]); @@ -592,7 +551,6 @@ static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role) static void Crs_ConfigIndicators (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Indicators; extern const char *Txt_of_PART_OF_A_TOTAL; struct Ind_IndicatorsCrs Indicators; @@ -602,9 +560,7 @@ static void Crs_ConfigIndicators (void) NumIndicatorsFromDB,&Indicators); HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Indicators); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Indicators); HTM_TD_Begin ("class=\"LM\""); Frm_StartForm (ActReqStaCrs); diff --git a/swad_degree.c b/swad_degree.c index 693fd4764..749fc8abb 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -395,18 +395,12 @@ static void Deg_ConfigTitle (bool PutLink) static void Deg_ConfigCentre (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Centre; unsigned NumCtr; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"OthCtrCod\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Centre); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("OthCtrCod",Txt_Centre); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -447,16 +441,11 @@ static void Deg_ConfigCentre (bool PrintView) static void Deg_ConfigFullName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Degree; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"FullName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Degree); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("FullName",Txt_Degree); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -483,16 +472,11 @@ static void Deg_ConfigFullName (bool PrintView) static void Deg_ConfigShrtName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Short_name; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"ShortName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Short_name); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("ShortName",Txt_Short_name); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -519,17 +503,11 @@ static void Deg_ConfigShrtName (bool PrintView) static void Deg_ConfigWWW (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Web; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"WWW\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Web); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("WWW",Txt_Web); HTM_TD_Begin ("class=\"DAT LM\""); if (!PrintView && @@ -540,7 +518,7 @@ static void Deg_ConfigWWW (bool PrintView) /* Form to change degree WWW */ Frm_StartForm (ActChgDegWWWCfg); HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Deg.WWW,true, - "class=\"INPUT_WWW_WIDE\" required=\"required\""); + "id=\"WWW\" class=\"INPUT_WWW_WIDE\" required=\"required\""); Frm_EndForm (); } else // I can not change degree WWW @@ -564,14 +542,11 @@ static void Deg_ConfigWWW (bool PrintView) static void Deg_ConfigShortcut (void) { extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Shortcut; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Shortcut); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Shortcut); HTM_TD_Begin ("class=\"DAT LM\""); HTM_A_Begin ("href=\"%s/%s?deg=%ld\" class=\"DAT\" target=\"_blank\"", @@ -594,14 +569,11 @@ static void Deg_ConfigShortcut (void) static void Deg_ConfigQR (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_QR_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_QR_code); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_QR_code); HTM_TD_Begin ("class=\"DAT LM\""); QR_LinkTo (250,"deg",Gbl.Hierarchy.Deg.DegCod); @@ -616,15 +588,12 @@ static void Deg_ConfigQR (void) static void Deg_ConfigNumCrss (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Courses; extern const char *Txt_Courses_of_DEGREE_X; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Courses); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Courses); /* Form to go to see courses of this degree */ HTM_TD_Begin ("class=\"LM\""); @@ -648,16 +617,13 @@ static void Deg_ConfigNumCrss (void) static void Deg_ShowNumUsrsInCrssOfDeg (Rol_Role_t Role) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Users_in_courses; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Role == Rol_UNK ? Txt_Users_in_courses : - Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Role == Rol_UNK ? Txt_Users_in_courses : + Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Usr_GetNumUsrsInCrssOfDeg (Role,Gbl.Hierarchy.Deg.DegCod)); diff --git a/swad_hierarchy.c b/swad_hierarchy.c index ce8deaf68..2a5789c66 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -85,6 +85,26 @@ void Hie_ConfigTitle (bool PutLink, HTM_DIV_End (); } +/*****************************************************************************/ +/****************** Show label column in configuration ***********************/ +/*****************************************************************************/ + +void Hie_ConfigLabel (const char *Id,const char *Label) + { + extern const char *The_ClassFormInBox[The_NUM_THEMES]; + + HTM_TD_Begin ("class=\"RM\""); + if (Id) + HTM_LABEL_Begin ("for=\"%s\" class=\"%s\"", + Id,The_ClassFormInBox[Gbl.Prefs.Theme]); + else + HTM_LABEL_Begin ("class=\"%s\"", + The_ClassFormInBox[Gbl.Prefs.Theme]); + HTM_TxtF ("%s:",Label); + HTM_LABEL_End (); + HTM_TD_End (); + } + /*****************************************************************************/ /********** List pending institutions, centres, degrees and courses **********/ /*****************************************************************************/ diff --git a/swad_hierarchy.h b/swad_hierarchy.h index 5ec721089..bfbac8c7b 100644 --- a/swad_hierarchy.h +++ b/swad_hierarchy.h @@ -65,6 +65,7 @@ void Hie_ConfigTitle (bool PutLink, char LogoFullName[Hie_MAX_BYTES_FULL_NAME + 1], char LogoWWW[Cns_MAX_BYTES_WWW + 1], char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]); +void Hie_ConfigLabel (const char *Id,const char *Label); void Hie_SeePending (void); diff --git a/swad_institution.c b/swad_institution.c index 9e0f032f9..cf062df09 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -502,18 +502,12 @@ static void Ins_ConfigMap (void) static void Ins_ConfigCountry (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Country; unsigned NumCty; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"OthCtyCod\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Country); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("OthCtyCod",Txt_Country); HTM_TD_Begin ("class=\"DAT LM\""); if (!PrintView && @@ -553,16 +547,11 @@ static void Ins_ConfigCountry (bool PrintView) static void Ins_ConfigFullName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Institution; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"FullName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Institution); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("FullName",Txt_Institution); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -588,16 +577,11 @@ static void Ins_ConfigFullName (bool PrintView) static void Ins_ConfigShrtName (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Short_name; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"ShortName\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Short_name); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("ShortName",Txt_Short_name); HTM_TD_Begin ("class=\"DAT_N LM\""); if (!PrintView && @@ -623,17 +607,11 @@ static void Ins_ConfigShrtName (bool PrintView) static void Ins_ConfigWWW (bool PrintView) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Web; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"RM\""); - HTM_LABEL_Begin ("for=\"WWW\" class=\"%s\"", - The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Web); - HTM_LABEL_End (); - HTM_TD_End (); + Hie_ConfigLabel ("WWW",Txt_Web); HTM_TD_Begin ("class=\"DAT LM\""); if (!PrintView && @@ -644,7 +622,7 @@ static void Ins_ConfigWWW (bool PrintView) /* Form to change institution WWW */ Frm_StartForm (ActChgInsWWWCfg); HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Ins.WWW,true, - "class=\"INPUT_WWW_WIDE\" required=\"required\""); + "id=\"WWW\" class=\"INPUT_WWW_WIDE\" required=\"required\""); Frm_EndForm (); } else // I can not change institution WWW @@ -668,14 +646,11 @@ static void Ins_ConfigWWW (bool PrintView) static void Ins_ConfigShortcut (void) { extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Shortcut; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Shortcut); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Shortcut); HTM_TD_Begin ("class=\"LM\""); HTM_A_Begin ("href=\"%s/%s?ins=%ld\" class=\"DAT\" target=\"_blank\"", @@ -698,14 +673,11 @@ static void Ins_ConfigShortcut (void) static void Ins_ConfigQR (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_QR_code; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_QR_code); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_QR_code); HTM_TD_Begin ("class=\"LM\""); QR_LinkTo (250,"ins",Gbl.Hierarchy.Ins.InsCod); @@ -720,14 +692,11 @@ static void Ins_ConfigQR (void) static void Ins_ConfigNumUsrs (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Users_of_the_institution; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Users_of_the_institution); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Users_of_the_institution); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Usr_GetNumUsrsWhoClaimToBelongToIns (Gbl.Hierarchy.Ins.InsCod)); @@ -742,15 +711,12 @@ static void Ins_ConfigNumUsrs (void) static void Ins_ConfigNumCtrs (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Centres; extern const char *Txt_Centres_of_INSTITUTION_X; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Centres); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Centres); /* Form to go to see centres of this institution */ HTM_TD_Begin ("class=\"LM\""); @@ -774,15 +740,12 @@ static void Ins_ConfigNumCtrs (void) static void Ins_ConfigNumDegs (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Degrees; /***** Number of degrees *****/ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Degrees); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Degrees); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Deg_GetNumDegsInIns (Gbl.Hierarchy.Ins.InsCod)); @@ -797,14 +760,11 @@ static void Ins_ConfigNumDegs (void) static void Ins_ConfigNumCrss (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Courses; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Courses); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Courses); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Crs_GetNumCrssInIns (Gbl.Hierarchy.Ins.InsCod)); @@ -819,14 +779,11 @@ static void Ins_ConfigNumCrss (void) static void Ins_ConfigNumDpts (void) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Departments; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Txt_Departments); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Txt_Departments); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Dpt_GetNumDepartmentsInInstitution (Gbl.Hierarchy.Ins.InsCod)); @@ -841,16 +798,13 @@ static void Ins_ConfigNumDpts (void) static void Ins_ShowNumUsrsInCrssOfIns (Rol_Role_t Role) { - extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Users_in_courses; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - HTM_TxtF ("%s:",Role == Rol_UNK ? Txt_Users_in_courses : - Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); - HTM_TD_End (); + Hie_ConfigLabel (NULL,Role == Rol_UNK ? Txt_Users_in_courses : + Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); HTM_TD_Begin ("class=\"DAT LM\""); HTM_Unsigned (Usr_GetNumUsrsInCrssOfIns (Role,Gbl.Hierarchy.Ins.InsCod));