From 359dd28b2838639d2487fde4bb9e39fbd53267ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 30 Dec 2019 18:49:52 +0100 Subject: [PATCH] Version19.108.5 --- swad_ID.c | 4 +- swad_account.c | 4 +- swad_agenda.c | 12 +-- swad_calendar.c | 10 +- swad_centre.c | 8 +- swad_centre_config.c | 4 +- swad_changelog.h | 3 +- swad_country_config.c | 4 +- swad_course.c | 16 +-- swad_degree.c | 8 +- swad_degree_config.c | 4 +- swad_department.c | 8 +- swad_figure.c | 13 ++- swad_forum.c | 22 ++--- swad_game.c | 8 +- swad_group.c | 12 +-- swad_help.c | 32 +++--- swad_hierarchy.c | 4 +- swad_institution.c | 8 +- swad_institution_config.c | 4 +- swad_mail.c | 4 +- swad_match_result.c | 16 +-- swad_project.c | 8 +- swad_report.c | 12 +-- swad_statistic.c | 20 ++-- swad_string.c | 37 ++++--- swad_string.h | 5 +- swad_syllabus.c | 16 +-- swad_test.c | 15 ++- swad_text.c | 202 +++++++++++++++++++------------------- swad_timeline.c | 36 +++---- 31 files changed, 282 insertions(+), 277 deletions(-) diff --git a/swad_ID.c b/swad_ID.c index fb2cd31d..a84c1d1b 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -649,10 +649,10 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, HTM_SPAN_Begin ("class=\"%s\" title=\"%s\"", UsrDat->IDs.List[NumID].Confirmed ? "USR_ID_C" : "USR_ID_NC", - Str_BuildStrMsg (UsrDat->IDs.List[NumID].Confirmed ? Txt_ID_X_confirmed : + Str_BuildMsgStr (UsrDat->IDs.List[NumID].Confirmed ? Txt_ID_X_confirmed : Txt_ID_X_not_confirmed, UsrDat->IDs.List[NumID].ID)); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_Txt (UsrDat->IDs.List[NumID].ID); HTM_Txt (UsrDat->IDs.List[NumID].Confirmed ? "✓" : ""); diff --git a/swad_account.c b/swad_account.c index bfbc9232..cc271c8a 100644 --- a/swad_account.c +++ b/swad_account.c @@ -420,10 +420,10 @@ void Acc_ShowFormGoToRequestNewAccount (void) extern const char *Txt_Create_account; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_New_on_PLATFORM_Sign_up, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_New_on_PLATFORM_Sign_up, Cfg_PLATFORM_SHORT_NAME),NULL, Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Button to go to request the creation of a new account *****/ Frm_StartForm (ActFrmMyAcc); diff --git a/swad_agenda.c b/swad_agenda.c index c81fc022..48d582ab 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -357,12 +357,12 @@ void Agd_ShowUsrAgenda (void) /***** Begin box *****/ ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); - Box_BoxBegin ("100%",Str_BuildStrMsg (Txt_Public_agenda_USER, + Box_BoxBegin ("100%",Str_BuildMsgStr (Txt_Public_agenda_USER, Gbl.Usrs.Other.UsrDat.FullName), ItsMe ? Agd_PutIconsMyPublicAgenda : Agd_PutIconsOtherPublicAgenda, Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Show the current events in the user's agenda *****/ Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY); @@ -400,12 +400,12 @@ void Agd_ShowOtherAgendaAfterLogIn (void) { /***** Begin box *****/ ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); - Box_BoxBegin ("100%",Str_BuildStrMsg (Txt_Public_agenda_USER, + Box_BoxBegin ("100%",Str_BuildMsgStr (Txt_Public_agenda_USER, Gbl.Usrs.Other.UsrDat.FullName), ItsMe ? Agd_PutIconToViewEditMyFullAgenda : Agd_PutIconsOtherPublicAgenda, Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Show the current events in the user's agenda *****/ Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY); @@ -1900,10 +1900,10 @@ void Agd_PrintAgdQRCode (void) extern const char *Txt_Where_s_USER; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Where_s_USER, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Where_s_USER, Gbl.Usrs.Me.UsrDat.FullName),NULL, NULL,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Print QR code ****/ QR_PrintQRCode (); diff --git a/swad_calendar.c b/swad_calendar.c index 0d1788ea..80f67202 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -106,7 +106,7 @@ static void Cal_PutIconsFirstDayOfWeek (void) void Cal_ShowFormToSelFirstDayOfWeek (Act_Action_t Action,void (*FuncParams) (void)) { - extern const char *Txt_First_day_of_the_week; + extern const char *Txt_First_day_of_the_week_X; extern const char *Txt_DAYS_SMALL[7]; unsigned FirstDayOfWeek; char Icon[32 + 1]; @@ -124,13 +124,13 @@ void Cal_ShowFormToSelFirstDayOfWeek (Act_Action_t Action,void (*FuncParams) (vo Par_PutHiddenParamUnsigned (NULL,"FirstDayOfWeek",FirstDayOfWeek); if (FuncParams) // Extra parameters depending on the action FuncParams (); - snprintf (Gbl.Title,sizeof (Gbl.Title), - "%s: %s", - Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek]); snprintf (Icon,sizeof (Icon), "first-day-of-week-%u.png", FirstDayOfWeek); - Ico_PutSettingIconLink (Icon,Gbl.Title); + Ico_PutSettingIconLink (Icon, + Str_BuildMsgStr (Txt_First_day_of_the_week_X, + Txt_DAYS_SMALL[FirstDayOfWeek])); + Str_FreeMsg (); Frm_EndForm (); HTM_DIV_End (); } diff --git a/swad_centre.c b/swad_centre.c index affabb95..d4c12221 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -264,11 +264,11 @@ static void Ctr_ListCentres (void) unsigned NumCtr; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Centres_of_INSTITUTION_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Centres_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName), Ctr_PutIconsListingCentres, Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); if (Gbl.Hierarchy.Ins.Ctrs.Num) // There are centres in the current institution { @@ -476,11 +476,11 @@ static void Ctr_EditCentresInternal (void) Hie_WriteMenuHierarchy (); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Centres_of_INSTITUTION_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Centres_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName), Ctr_PutIconsEditingCentres, Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Put a form to create a new centre *****/ Ctr_PutFormToCreateCentre (); diff --git a/swad_centre_config.c b/swad_centre_config.c index b5181670..ac69129d 100644 --- a/swad_centre_config.c +++ b/swad_centre_config.c @@ -797,10 +797,10 @@ static void CtrCfg_NumDegs (void) HTM_TD_Begin ("class=\"LB\""); Frm_StartFormGoTo (ActSeeDeg); Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod); - HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Degrees_of_CENTRE_X, + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgStr (Txt_Degrees_of_CENTRE_X, Gbl.Hierarchy.Ctr.ShrtName), "BT_LINK DAT",NULL); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_Unsigned (Deg_GetNumDegsInCtr (Gbl.Hierarchy.Ctr.CtrCod)); HTM_BUTTON_End (); Frm_EndForm (); diff --git a/swad_changelog.h b/swad_changelog.h index 49debe55..d5c281c0 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.108.4 (2019-12-30)" +#define Log_PLATFORM_VERSION "SWAD 19.108.5 (2019-12-30)" #define CSS_FILE "swad19.101.5.css" #define JS_FILE "swad19.91.1.js" /* @@ -502,6 +502,7 @@ ps2pdf source.ps destination.pdf Version 19.10x: Dec 30, 2019 Map in country information. (? lines) Version 19.10x: Dec 30, 2019 Map in institution information. (? lines) + Version 19.108.5: Dec 30, 2019 Code refactoring related to printing messages. (249712 lines) Version 19.108.4: Dec 30, 2019 Code refactoring related to printing messages. (249709 lines) Version 19.108.3: Dec 30, 2019 Code refactoring related to printing messages. (249725 lines) Version 19.108.2: Dec 30, 2019 Code refactoring related to printing messages. (249739 lines) diff --git a/swad_country_config.c b/swad_country_config.c index 137a6388..3280d80f 100644 --- a/swad_country_config.c +++ b/swad_country_config.c @@ -343,10 +343,10 @@ static void CtyCfg_NumInss (void) HTM_TD_Begin ("class=\"LB\""); Frm_StartFormGoTo (ActSeeIns); Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod); - HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Institutions_of_COUNTRY_X, + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgStr (Txt_Institutions_of_COUNTRY_X, Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]), "BT_LINK DAT",NULL); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_Unsigned (Ins_GetNumInssInCty (Gbl.Hierarchy.Cty.CtyCod)); HTM_BUTTON_End (); Frm_EndForm (); diff --git a/swad_course.c b/swad_course.c index ada5c417..bea9ce12 100644 --- a/swad_course.c +++ b/swad_course.c @@ -743,11 +743,11 @@ static void Crs_ListCourses (void) unsigned Year; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Courses_of_DEGREE_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Courses_of_DEGREE_X, Gbl.Hierarchy.Deg.ShrtName), Crs_PutIconsListCourses, Hlp_DEGREE_Courses,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); if (Gbl.Hierarchy.Deg.Crss.Num) // There are courses in the current degree { @@ -947,11 +947,11 @@ static void Crs_EditCoursesInternal (void) Hie_WriteMenuHierarchy (); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Courses_of_DEGREE_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Courses_of_DEGREE_X, Gbl.Hierarchy.Deg.ShrtName), Crs_PutIconsEditingCourses, Hlp_DEGREE_Courses,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Put a form to create or request a new course *****/ Crs_PutFormToCreateCourse (); @@ -2269,9 +2269,9 @@ static void Crs_PutButtonToRegisterInCrs (void) // If the course being edited is different to the current one... if (Crs_EditingCrs->CrsCod != Gbl.Hierarchy.Crs.CrsCod) Crs_PutParamCrsCod (Crs_EditingCrs->CrsCod); - Btn_PutCreateButton (Str_BuildStrMsg (Txt_Register_me_in_X, + Btn_PutCreateButton (Str_BuildMsgStr (Txt_Register_me_in_X, Crs_EditingCrs->ShrtName)); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); } @@ -2445,10 +2445,10 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role) HTM_TR_Begin (NULL); HTM_TH_Begin (1,7,"LM"); - HTM_TxtF ("%s:",Str_BuildStrMsg (Txt_USER_in_COURSE, + HTM_TxtF ("%s:",Str_BuildMsgStr (Txt_USER_in_COURSE, Role == Rol_UNK ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNK ==> any role Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex])); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_TH_End (); HTM_TR_End (); diff --git a/swad_degree.c b/swad_degree.c index 61213234..973a5cd4 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -763,11 +763,11 @@ static void Deg_ListDegrees (void) unsigned NumDeg; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Degrees_of_CENTRE_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Degrees_of_CENTRE_X, Gbl.Hierarchy.Ctr.ShrtName), Deg_PutIconsListingDegrees, Hlp_CENTRE_Degrees,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); if (Gbl.Hierarchy.Ctr.Degs.Num) // There are degrees in the current centre { @@ -945,11 +945,11 @@ static void Deg_EditDegreesInternal (void) Hie_WriteMenuHierarchy (); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Degrees_of_CENTRE_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Degrees_of_CENTRE_X, Gbl.Hierarchy.Ctr.ShrtName), Deg_PutIconsEditingDegrees, Hlp_CENTRE_Degrees,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); if (Gbl.DegTypes.Num) { diff --git a/swad_degree_config.c b/swad_degree_config.c index fcc84bd9..34a9bb07 100644 --- a/swad_degree_config.c +++ b/swad_degree_config.c @@ -334,10 +334,10 @@ static void DegCfg_NumCrss (void) HTM_TD_Begin ("class=\"LB\""); Frm_StartFormGoTo (ActSeeCrs); Deg_PutParamDegCod (Gbl.Hierarchy.Deg.DegCod); - HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Courses_of_DEGREE_X, + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgStr (Txt_Courses_of_DEGREE_X, Gbl.Hierarchy.Deg.ShrtName), "BT_LINK DAT",NULL); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_Unsigned (Crs_GetNumCrssInDeg (Gbl.Hierarchy.Deg.DegCod)); HTM_BUTTON_End (); Frm_EndForm (); diff --git a/swad_department.c b/swad_department.c index 40f71515..b2747ee6 100644 --- a/swad_department.c +++ b/swad_department.c @@ -111,12 +111,12 @@ void Dpt_SeeDepts (void) Dpt_GetListDepartments (Gbl.Hierarchy.Ins.InsCod); /***** Begin box and table *****/ - Box_BoxTableBegin (NULL,Str_BuildStrMsg (Txt_Departments_of_INSTITUTION_X, + Box_BoxTableBegin (NULL,Str_BuildMsgStr (Txt_Departments_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName), Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Dpt_PutIconToEditDpts : NULL, Hlp_INSTITUTION_Departments,Box_NOT_CLOSABLE,2); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Write heading *****/ HTM_TR_Begin (NULL); @@ -266,10 +266,10 @@ static void Dpt_EditDepartmentsInternal (void) Dpt_GetListDepartments (Gbl.Hierarchy.Ins.InsCod); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Departments_of_INSTITUTION_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Departments_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName),NULL, Hlp_INSTITUTION_Departments_edit,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Put a form to create a new department *****/ Dpt_PutFormToCreateDepartment (); diff --git a/swad_figure.c b/swad_figure.c index 8515c791..80c2dcf5 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -4921,14 +4921,13 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void) extern const char *Hlp_ANALYTICS_Figures_calendar; extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES]; extern const char *Txt_Calendar; - extern const char *Txt_First_day_of_the_week; + extern const char *Txt_First_day_of_the_week_X; extern const char *Txt_DAYS_SMALL[7]; extern const char *Txt_No_of_users; extern const char *Txt_PERCENT_of_users; unsigned FirstDayOfWeek; char *SubQuery; char *Icon; - char *Title; unsigned NumUsrs[7]; // 7: seven days in a week unsigned NumUsrsTotal = 0; @@ -4974,11 +4973,11 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void) if (asprintf (&Icon,"first-day-of-week-%u.png", FirstDayOfWeek) < 0) Lay_NotEnoughMemoryExit (); - if (asprintf (&Title,"%s: %s", - Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek]) < 0) - Lay_NotEnoughMemoryExit (); - Ico_PutIcon (Icon,Title,"ICO40x40"); - free (Title); + Ico_PutIcon (Icon, + Str_BuildMsgStr (Txt_First_day_of_the_week_X, + Txt_DAYS_SMALL[FirstDayOfWeek]), + "ICO40x40"); + Str_FreeMsg (); free (Icon); HTM_TD_End (); diff --git a/swad_forum.c b/swad_forum.c index 0315f7c6..9be53f88 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1234,27 +1234,23 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod, Gbl.Forum.ForumSelected.Location, Gbl.Forum.ForumSelected.ThrCod, PstCod); - - snprintf (Gbl.Title,sizeof (Gbl.Title), - Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it : - Txt_FORUM_Post_X_banned_Click_to_unban_it, - PstNum); Ico_PutIconLink (Enabled ? "eye.svg" : "eye-slash.svg", - Gbl.Title); + Str_BuildMsgLong (Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it : + Txt_FORUM_Post_X_banned_Click_to_unban_it, + (long) PstNum)); + Str_FreeMsg (); Frm_EndForm (); } else { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Enabled ? Txt_FORUM_Post_X_allowed : - Txt_FORUM_Post_X_banned, - PstNum); - HTM_SPAN_Begin ("title=\"%s\"",Gbl.Title); // TODO: Remove? Ico_PutIcon (Enabled ? "eye.svg" : "eye-slash.svg", - Gbl.Title,"ICO_HIDDEN ICO16x16"); - HTM_SPAN_End (); // TODO: Remove? + Str_BuildMsgLong (Enabled ? Txt_FORUM_Post_X_allowed : + Txt_FORUM_Post_X_banned, + (long) PstNum), + "ICO_HIDDEN ICO16x16"); + Str_FreeMsg (); } /***** Form to remove post *****/ diff --git a/swad_game.c b/swad_game.c index 4bffb410..bc615828 100644 --- a/swad_game.c +++ b/swad_game.c @@ -1871,9 +1871,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (long GamCod,unsigned NumQsts, { Lay_PutContextualLinkOnlyIcon (ActUp_GamQst,NULL,Gam_PutParamsOneQst, "arrow-up.svg", - Str_BuildStrMsg (Txt_Move_up_X, + Str_BuildMsgStr (Txt_Move_up_X, StrQstInd)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-up.svg",Txt_Movement_not_allowed); @@ -1883,9 +1883,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (long GamCod,unsigned NumQsts, { Lay_PutContextualLinkOnlyIcon (ActDwnGamQst,NULL,Gam_PutParamsOneQst, "arrow-down.svg", - Str_BuildStrMsg (Txt_Move_down_X, + Str_BuildMsgStr (Txt_Move_down_X, StrQstInd)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-down.svg",Txt_Movement_not_allowed); diff --git a/swad_group.c b/swad_group.c index d94792f9..7b10205a 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1509,10 +1509,10 @@ static void Grp_ListGroupsForEdition (void) Grp_PutParamGrpCod (Grp->GrpCod); Ico_PutIconLink (Grp->Open ? "unlock.svg" : "lock.svg", - Str_BuildStrMsg (Grp->Open ? Txt_Group_X_open_click_to_close_it : + Str_BuildMsgStr (Grp->Open ? Txt_Group_X_open_click_to_close_it : Txt_Group_X_closed_click_to_open_it, Grp->GrpName)); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); HTM_TD_End (); @@ -1524,10 +1524,10 @@ static void Grp_ListGroupsForEdition (void) Grp_PutParamGrpCod (Grp->GrpCod); Ico_PutIconLink (Grp->FileZones ? "folder-open-green.svg" : "folder-red.svg", - Str_BuildStrMsg (Grp->FileZones ? Txt_File_zones_of_the_group_X_enabled_click_to_disable_them : + Str_BuildMsgStr (Grp->FileZones ? Txt_File_zones_of_the_group_X_enabled_click_to_disable_them : Txt_File_zones_of_the_group_X_disabled_click_to_enable_them, Grp->GrpName)); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); HTM_TD_End (); @@ -2381,10 +2381,10 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) HTM_TD_Begin ("class=\"BM\""); Ico_PutIconOff (Grp->Open ? "unlock.svg" : "lock.svg", - Str_BuildStrMsg (Grp->Open ? Txt_Group_X_open : + Str_BuildMsgStr (Grp->Open ? Txt_Group_X_open : Txt_Group_X_closed, Grp->GrpName)); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_TD_End (); /***** Group name *****/ diff --git a/swad_help.c b/swad_help.c index 42efdd42..53260234 100644 --- a/swad_help.c +++ b/swad_help.c @@ -141,21 +141,21 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role] != ActUnk) { /* Request my removing from this course */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Txt_Remove_me_from_THE_COURSE_X, + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Txt_Remove_me_from_THE_COURSE_X, Gbl.Hierarchy.Crs.ShrtName), ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role], Btn_REMOVE_BUTTON,Txt_Remove_me); - Str_FreeStrMsg (); + Str_FreeMsg (); } } else // I do not belong to this course { /* Request my registration in this course */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Txt_Register_me_in_X, + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Txt_Register_me_in_X, Gbl.Hierarchy.Crs.ShrtName), ActReqSignUp, Btn_CREATE_BUTTON,Txt_Sign_up); - Str_FreeStrMsg (); + Str_FreeMsg (); } } @@ -166,11 +166,11 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course { /* Request students enrolment */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Txt_Register_students_in_COURSE_X, + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Txt_Register_students_in_COURSE_X, Gbl.Hierarchy.Crs.ShrtName), ActReqEnrSevStd, Btn_CREATE_BUTTON,Txt_Register_students); - Str_FreeStrMsg (); + Str_FreeMsg (); } if (Gbl.Action.Act != ActMyCrs) // I am not seeing the action to list my courses @@ -183,42 +183,42 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) if (Gbl.Hierarchy.Deg.DegCod > 0) // Degree selected { /* Select a course */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Gbl.Hierarchy.Level == Hie_CRS ? Txt_Select_create_course_in_X : + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Gbl.Hierarchy.Level == Hie_CRS ? Txt_Select_create_course_in_X : Txt_Select_or_create_one_course_in_X, Gbl.Hierarchy.Deg.ShrtName), ActSeeCrs, Btn_CONFIRM_BUTTON,Txt_Courses); - Str_FreeStrMsg (); + Str_FreeMsg (); } else if (Gbl.Hierarchy.Ctr.CtrCod > 0) // Centre selected { /* Select a degree */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Gbl.Hierarchy.Deg.DegCod > 0 ? Txt_Select_or_create_another_degree_in_X : + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Gbl.Hierarchy.Deg.DegCod > 0 ? Txt_Select_or_create_another_degree_in_X : Txt_Select_or_create_one_degree_in_X, Gbl.Hierarchy.Ctr.ShrtName), ActSeeDeg, Btn_CONFIRM_BUTTON,Txt_Degrees); - Str_FreeStrMsg (); + Str_FreeMsg (); } else if (Gbl.Hierarchy.Ins.InsCod > 0) // Institution selected { /* Select a centre */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Gbl.Hierarchy.Ctr.CtrCod > 0 ? Txt_Select_or_create_another_centre_in_X : + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Gbl.Hierarchy.Ctr.CtrCod > 0 ? Txt_Select_or_create_another_centre_in_X : Txt_Select_or_create_one_centre_in_X, Gbl.Hierarchy.Ins.ShrtName), ActSeeCtr, Btn_CONFIRM_BUTTON,Txt_Centres); - Str_FreeStrMsg (); + Str_FreeMsg (); } else if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected { /* Select an institution */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Gbl.Hierarchy.Ins.InsCod > 0 ? Txt_Select_or_create_another_institution_in_X : + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Gbl.Hierarchy.Ins.InsCod > 0 ? Txt_Select_or_create_another_institution_in_X : Txt_Select_or_create_one_institution_in_X, Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]), ActSeeIns, Btn_CONFIRM_BUTTON,Txt_Institutions); - Str_FreeStrMsg (); + Str_FreeMsg (); } else /* Select a country */ @@ -240,11 +240,11 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) Btn_CONFIRM_BUTTON,Txt_Log_in); /* Sign up */ - Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStrMsg (Txt_New_on_PLATFORM_Sign_up, + Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildMsgStr (Txt_New_on_PLATFORM_Sign_up, Cfg_PLATFORM_SHORT_NAME), ActFrmMyAcc, Btn_CREATE_BUTTON,Txt_Create_account); - Str_FreeStrMsg (); + Str_FreeMsg (); } /***** End table and box *****/ diff --git a/swad_hierarchy.c b/swad_hierarchy.c index bd246d51..0c2692e3 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -788,10 +788,10 @@ char *Hie_BuildGoToMsg (const char *Where) { extern const char *Txt_Go_to_X; - return Str_BuildStrMsg (Txt_Go_to_X,Where); + return Str_BuildMsgStr (Txt_Go_to_X,Where); } void Hie_FreeGoToMsg (void) { - Str_FreeStrMsg (); + Str_FreeMsg (); } diff --git a/swad_institution.c b/swad_institution.c index 627584ac..40600da7 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -291,11 +291,11 @@ static void Ins_ListInstitutions (void) unsigned NumIns; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Institutions_of_COUNTRY_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Institutions_of_COUNTRY_X, Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]), Ins_PutIconsListingInstitutions, Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); if (Gbl.Hierarchy.Cty.Inss.Num) // There are institutions in the current country { @@ -538,11 +538,11 @@ static void Ins_EditInstitutionsInternal (void) Hie_WriteMenuHierarchy (); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Institutions_of_COUNTRY_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Institutions_of_COUNTRY_X, Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]), Ins_PutIconsEditingInstitutions, Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Put a form to create a new institution *****/ Ins_PutFormToCreateInstitution (); diff --git a/swad_institution_config.c b/swad_institution_config.c index e4279ab7..3216d866 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -467,10 +467,10 @@ static void InsCfg_NumCtrs (void) HTM_TD_Begin ("class=\"LB\""); Frm_StartFormGoTo (ActSeeCtr); Ins_PutParamInsCod (Gbl.Hierarchy.Ins.InsCod); - HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Centres_of_INSTITUTION_X, + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgStr (Txt_Centres_of_INSTITUTION_X, Gbl.Hierarchy.Ins.ShrtName), "BT_LINK DAT",NULL); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_Unsigned (Ctr_GetNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod)); HTM_BUTTON_End (); Frm_EndForm (); diff --git a/swad_mail.c b/swad_mail.c index 22424a8f..d2e80e8d 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -1309,9 +1309,9 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, if (Confirmed) { Ico_PutIcon ("check-circle.svg", - Str_BuildStrMsg (Txt_Email_X_confirmed,row[0]), + Str_BuildMsgStr (Txt_Email_X_confirmed,row[0]), "ICO16x16"); - Str_FreeStrMsg (); + Str_FreeMsg (); } /* Form to change user's email */ diff --git a/swad_match_result.c b/swad_match_result.c index bffe6bd0..c26ccdec 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -176,9 +176,9 @@ void McR_ShowMyMchResultsInGam (void) false); // Do not put form to start new match /***** List my matches results in game *****/ - McR_ShowResultsBegin (Str_BuildStrMsg (Txt_Results_of_game_X,Game.Title), + McR_ShowResultsBegin (Str_BuildMsgStr (Txt_Results_of_game_X,Game.Title), false); // Do not list games to select - Str_FreeStrMsg (); + Str_FreeMsg (); McR_ListMyMchResultsInGam (Game.GamCod); McR_ShowResultsEnd (); @@ -220,9 +220,9 @@ void McR_ShowMyMchResultsInMch (void) false); // Do not put form to start new match /***** List my matches results in match *****/ - McR_ShowResultsBegin (Str_BuildStrMsg (Txt_Results_of_match_X,Match.Title), + McR_ShowResultsBegin (Str_BuildMsgStr (Txt_Results_of_match_X,Match.Title), false); // Do not list games to select - Str_FreeStrMsg (); + Str_FreeMsg (); McR_ListMyMchResultsInMch (Match.MchCod); McR_ShowResultsEnd (); @@ -320,9 +320,9 @@ void McR_ShowAllMchResultsInGam (void) false); // Do not put form to start new match /***** List matches results in game *****/ - McR_ShowResultsBegin (Str_BuildStrMsg (Txt_Results_of_game_X,Game.Title), + McR_ShowResultsBegin (Str_BuildMsgStr (Txt_Results_of_game_X,Game.Title), false); // Do not list games to select - Str_FreeStrMsg (); + Str_FreeMsg (); McR_ListAllMchResultsInGam (Game.GamCod); McR_ShowResultsEnd (); @@ -405,9 +405,9 @@ void McR_ShowAllMchResultsInMch (void) false); // Do not put form to start new match /***** List matches results in match *****/ - McR_ShowResultsBegin (Str_BuildStrMsg (Txt_Results_of_match_X,Match.Title), + McR_ShowResultsBegin (Str_BuildMsgStr (Txt_Results_of_match_X,Match.Title), false); // Do not list games to select - Str_FreeStrMsg (); + Str_FreeMsg (); McR_ListAllMchResultsInMch (Match.MchCod); McR_ShowResultsEnd (); diff --git a/swad_project.c b/swad_project.c index d233f7e9..5987ae85 100644 --- a/swad_project.c +++ b/swad_project.c @@ -2061,9 +2061,9 @@ static void Prj_ShowOneProjectMembersWithARole (const struct Project *Prj, Gbl.Prjs.PrjCod = Prj->PrjCod; // Used to pass project code as a parameter Ico_PutContextualIconToAdd (ActionReqAddUsr[RoleInProject],NULL, Prj_PutCurrentParams, - Str_BuildStrMsg (Txt_Add_USERS, + Str_BuildMsgStr (Txt_Add_USERS, Txt_PROJECT_ROLES_PLURAL_abc[RoleInProject])); - Str_FreeStrMsg (); + Str_FreeMsg (); HTM_TD_End (); HTM_TD_Begin ("class=\"PRJ_MEMBER_PHO\""); // Column for photo @@ -2460,9 +2460,9 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject) Frm_StartForm (ActionRemUsr[RoleInProject]); Gbl.Prjs.PrjCod = Prj.PrjCod; Prj_PutCurrentParams (); - Btn_PutRemoveButton (Str_BuildStrMsg (Txt_Remove_USER_from_this_project, + Btn_PutRemoveButton (Str_BuildMsgStr (Txt_Remove_USER_from_this_project, Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject][Gbl.Usrs.Other.UsrDat.Sex])); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); /* End alert */ diff --git a/swad_report.c b/swad_report.c index cded05df..2f2563a9 100644 --- a/swad_report.c +++ b/swad_report.c @@ -158,10 +158,10 @@ void Rep_ReqMyUsageReport (void) Frm_StartForm (ActSeeMyUsgRep); /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Report_of_use_of_PLATFORM, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Report_of_use_of_PLATFORM, Cfg_PLATFORM_SHORT_NAME),NULL, Hlp_ANALYTICS_Report,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Header *****/ Rep_TitleReport (NULL); // NULL means do not write date @@ -264,10 +264,10 @@ static void Rep_PutLinkToMyUsageReport (struct Rep_Report *Report) extern const char *Txt_This_link_will_remain_active_as_long_as_your_user_s_account_exists; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Report_of_use_of_PLATFORM, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Report_of_use_of_PLATFORM, Cfg_PLATFORM_SHORT_NAME),NULL, Hlp_ANALYTICS_Report,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Header *****/ Rep_TitleReport (&Report->CurrentTimeUTC); @@ -994,12 +994,12 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role, NumCrss = Usr_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role); fprintf (Gbl.F.Rep,"
  • %s %u %s", - Str_BuildStrMsg (Txt_USER_in_COURSE, + Str_BuildMsgStr (Txt_USER_in_COURSE, Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]), NumCrss, NumCrss == 1 ? Txt_course : Txt_courses); - Str_FreeStrMsg (); + Str_FreeMsg (); if (NumCrss) { diff --git a/swad_statistic.c b/swad_statistic.c index cca9e111..e1ca4ed9 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -230,10 +230,10 @@ void Sta_AskShowCrsHits (void) Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs; /***** Begin box *****/ - Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Statistics_of_visits_to_the_course_X, + Box_BoxBegin (NULL,Str_BuildMsgStr (Txt_Statistics_of_visits_to_the_course_X, Gbl.Hierarchy.Crs.ShrtName),NULL, Hlp_ANALYTICS_Visits_visits_to_course,Box_NOT_CLOSABLE); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Show form to select the groups *****/ Grp_ShowFormToSelectSeveralGroups (NULL,Grp_MY_GROUPS); @@ -1494,10 +1494,10 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql HTM_TD_Begin ("class=\"LM\""); if (FirstRow > 1) { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_Show_previous_X_clicks, - Gbl.Stat.RowsPerPage); - HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK TIT_TBL",NULL); + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgLong (Txt_Show_previous_X_clicks, + (long) Gbl.Stat.RowsPerPage), + "BT_LINK TIT_TBL",NULL); + Str_FreeMsg (); HTM_STRONG_Begin (); HTM_TxtF ("<%s",Txt_PAGES_Previous); HTM_STRONG_End (); @@ -1532,10 +1532,10 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql HTM_TD_Begin ("class=\"RM\""); if (LastRow < NumRows) { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_Show_next_X_clicks, - Gbl.Stat.RowsPerPage); - HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK TIT_TBL",NULL); + HTM_BUTTON_SUBMIT_Begin (Str_BuildMsgLong (Txt_Show_next_X_clicks, + (long) Gbl.Stat.RowsPerPage), + "BT_LINK TIT_TBL",NULL); + Str_FreeMsg (); HTM_STRONG_Begin (); HTM_TxtF ("%s>",Txt_PAGES_Next); HTM_STRONG_End (); diff --git a/swad_string.c b/swad_string.c index 6df4a7c8..a90a2046 100644 --- a/swad_string.c +++ b/swad_string.c @@ -2924,27 +2924,40 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize) } /*****************************************************************************/ -/************************** Build a string message ***************************/ +/******************* Build and free a message with format ********************/ /*****************************************************************************/ + +static char *Str_Msg = NULL; + // FormatMsg must be a string including "%s" -// Str_FreeStrMsg() must be called after calling this function +// Str_FreeMsg() must be called after calling this function -static char *Str_StrMsg = NULL; - -char *Str_BuildStrMsg (const char *FormatMsg,const char *Str) +char *Str_BuildMsgStr (const char *fmt,const char *Str) { - Str_FreeStrMsg (); - if (asprintf (&Str_StrMsg,FormatMsg,Str) < 0) + Str_FreeMsg (); + if (asprintf (&Str_Msg,fmt,Str) < 0) Lay_NotEnoughMemoryExit (); - return Str_StrMsg; + return Str_Msg; } -void Str_FreeStrMsg (void) +// FormatMsg must be a string including "%ld" +// Str_FreeMsg() must be called after calling this function + +char *Str_BuildMsgLong (const char *fmt,long Num) { - if (Str_StrMsg != NULL) + Str_FreeMsg (); + if (asprintf (&Str_Msg,fmt,Num) < 0) + Lay_NotEnoughMemoryExit (); + + return Str_Msg; + } + +void Str_FreeMsg (void) + { + if (Str_Msg != NULL) { - free (Str_StrMsg); - Str_StrMsg = NULL; + free (Str_Msg); + Str_Msg = NULL; } } diff --git a/swad_string.h b/swad_string.h index 257237f1..aac29ba7 100644 --- a/swad_string.h +++ b/swad_string.h @@ -136,7 +136,8 @@ void Str_CreateRandomAlphanumStr (char *Str,size_t Length); void Str_Copy (char *Dst,const char *Src,size_t DstSize); void Str_Concat (char *Dst,const char *Src,size_t DstSize); -char *Str_BuildStrMsg (const char *FormatMsg,const char *Str); -void Str_FreeStrMsg (void); +char *Str_BuildMsgStr (const char *fmt,const char *Str); +char *Str_BuildMsgLong (const char *fmt,long Num); +void Str_FreeMsg (void); #endif diff --git a/swad_syllabus.c b/swad_syllabus.c index 08b68470..715bc9f2 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -624,10 +624,10 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, ActUp_IteSylPra, NULL,Syl_PutParamNumItem, "arrow-up.svg", - Str_BuildStrMsg (LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_up_X_and_its_subsections : + Str_BuildMsgStr (LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_up_X_and_its_subsections : Txt_Move_up_X, StrItemCod)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-up.svg",Txt_Movement_not_allowed); @@ -642,10 +642,10 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, ActDwnIteSylPra, NULL,Syl_PutParamNumItem, "arrow-down.svg", - Str_BuildStrMsg (LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_down_X_and_its_subsections : + Str_BuildMsgStr (LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_down_X_and_its_subsections : Txt_Move_down_X, StrItemCod)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-down.svg",Txt_Movement_not_allowed); @@ -659,9 +659,9 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, ActRgtIteSylPra, NULL,Syl_PutParamNumItem, "arrow-left.svg", - Str_BuildStrMsg (Txt_Increase_level_of_X, + Str_BuildMsgStr (Txt_Increase_level_of_X, StrItemCod)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-left.svg",Txt_Movement_not_allowed); @@ -676,9 +676,9 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, ActLftIteSylPra, NULL,Syl_PutParamNumItem, "arrow-right.svg", - Str_BuildStrMsg (Txt_Decrease_level_of_X, + Str_BuildMsgStr (Txt_Decrease_level_of_X, StrItemCod)); - Str_FreeStrMsg (); + Str_FreeMsg (); } else Ico_PutIconOff ("arrow-right.svg",Txt_Movement_not_allowed); diff --git a/swad_test.c b/swad_test.c index 31f731b2..ad351a6a 100644 --- a/swad_test.c +++ b/swad_test.c @@ -1841,9 +1841,9 @@ static void Tst_PutIconEnable (long TagCod,const char *TagTxt) Frm_StartForm (ActEnableTag); Par_PutHiddenParamLong (NULL,"TagCod",TagCod); Ico_PutIconLink ("eye-slash.svg", - Str_BuildStrMsg (Txt_Tag_X_not_allowed_Click_to_allow_it, + Str_BuildMsgStr (Txt_Tag_X_not_allowed_Click_to_allow_it, TagTxt)); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); HTM_TD_End (); } @@ -1860,9 +1860,9 @@ static void Tst_PutIconDisable (long TagCod,const char *TagTxt) Frm_StartForm (ActDisableTag); Par_PutHiddenParamLong (NULL,"TagCod",TagCod); Ico_PutIconLink ("eye.svg", - Str_BuildStrMsg (Txt_Tag_X_allowed_Click_to_disable_it, + Str_BuildMsgStr (Txt_Tag_X_allowed_Click_to_disable_it, TagTxt)); - Str_FreeStrMsg (); + Str_FreeMsg (); Frm_EndForm (); HTM_TD_End (); } @@ -5089,11 +5089,10 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1], /***** Begin box *****/ if (Gbl.Test.QstCod > 0) // The question already has assigned a code { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_Question_code_X, - Gbl.Test.QstCod); - Box_BoxBegin (NULL,Gbl.Title,Tst_PutIconToRemoveOneQst, + Box_BoxBegin (NULL,Str_BuildMsgLong (Txt_Question_code_X,Gbl.Test.QstCod), + Tst_PutIconToRemoveOneQst, Hlp_ASSESSMENT_Tests_writing_a_question,Box_NOT_CLOSABLE); + Str_FreeMsg (); } else Box_BoxBegin (NULL,Txt_New_question,NULL, diff --git a/swad_text.c b/swad_text.c index c360ea0d..200863d2 100644 --- a/swad_text.c +++ b/swad_text.c @@ -12464,25 +12464,25 @@ const char *Txt_Filter = // As a noun "Filtro"; #endif -const char *Txt_First_day_of_the_week = +const char *Txt_First_day_of_the_week_X = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "Primer dia de la setmana"; + "Primer dia de la setmana: %s"; #elif L==2 // de - "Erster Tag der Woche"; + "Erster Tag der Woche: %s"; #elif L==3 // en - "First day of the week"; + "First day of the week: %s"; #elif L==4 // es - "Primer día de la semana"; + "Primer día de la semana: %s"; #elif L==5 // fr - "Premier jour de la semaine"; + "Premier jour de la semaine: %s"; #elif L==6 // gn - "Primer día de la semana"; // Okoteve traducción + "Primer día de la semana: %s"; // Okoteve traducción #elif L==7 // it - "Primo giorno della settimana"; + "Primo giorno della settimana: %s"; #elif L==8 // pl - "Pierwszy dzień tygodnia"; + "Pierwszy dzień tygodnia: %s"; #elif L==9 // pt - "Primeiro dia da semana"; + "Primeiro dia da semana: %s"; #endif const char *Txt_First_name = @@ -13053,46 +13053,46 @@ const char *Txt_FORUM_posts = "posts"; #endif -const char *Txt_FORUM_Post_X_allowed = // Warning: it is very important to include %u in the following sentences +const char *Txt_FORUM_Post_X_allowed = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Comentario %u permitido."; // Necessita traduccio + "Comentario %ld permitido."; // Necessita traduccio #elif L==2 // de - "Post %u allowed."; // Need Übersetzung + "Post %ld allowed."; // Need Übersetzung #elif L==3 // en - "Post %u allowed."; + "Post %ld allowed."; #elif L==4 // es - "Comentario %u permitido."; + "Comentario %ld permitido."; #elif L==5 // fr - "Post %u allowed."; // Besoin de traduction + "Post %ld allowed."; // Besoin de traduction #elif L==6 // gn - "Comentario %u permitido."; // Okoteve traducción + "Comentario %ld permitido."; // Okoteve traducción #elif L==7 // it - "Post %u autorizzato."; + "Post %ld autorizzato."; #elif L==8 // pl - "Post %u dozwolone."; + "Post %ld dozwolone."; #elif L==9 // pt - "Post %u permitido."; + "Post %ld permitido."; #endif -const char *Txt_FORUM_Post_X_allowed_Click_to_ban_it = // Warning: it is very important to include %u in the following sentences +const char *Txt_FORUM_Post_X_allowed_Click_to_ban_it = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Comentario %u permitido. Pulse para censurarlo."; // Necessita traduccio + "Comentario %ld permitido. Pulse para censurarlo."; // Necessita traduccio #elif L==2 // de - "Post %u allowed. Click to ban it."; // Need Übersetzung + "Post %ld allowed. Click to ban it."; // Need Übersetzung #elif L==3 // en - "Post %u allowed. Click to ban it."; + "Post %ld allowed. Click to ban it."; #elif L==4 // es - "Comentario %u permitido. Pulse para censurarlo."; + "Comentario %ld permitido. Pulse para censurarlo."; #elif L==5 // fr - "Post %u allowed. Click to ban it."; // Besoin de traduction + "Post %ld allowed. Click to ban it."; // Besoin de traduction #elif L==6 // gn - "Comentario %u permitido. Pulse para censurarlo."; // Okoteve traducción + "Comentario %ld permitido. Pulse para censurarlo."; // Okoteve traducción #elif L==7 // it - "Post %u autorizzato. Clicca per censurarlo."; + "Post %ld autorizzato. Clicca per censurarlo."; #elif L==8 // pl - "Post% u dozwolone. Kliknij, aby to zakazac."; + "Post %ld dozwolone. Kliknij, aby to zakazac."; #elif L==9 // pt - "Post %u permitido. Clique para censurá-lo."; + "Post %ld permitido. Clique para censurá-lo."; #endif const char *Txt_FORUM_Post_and_thread_removed = @@ -13137,46 +13137,46 @@ const char *Txt_FORUM_Post_banned = "Post não permitido."; #endif -const char *Txt_FORUM_Post_X_banned = // Warning: it is very important to include %u in the following sentences +const char *Txt_FORUM_Post_X_banned = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Comentario %u no permitido"; // Necessita traduccio + "Comentario %ld no permitido"; // Necessita traduccio #elif L==2 // de - "Post %u banned."; // Need Übersetzung + "Post %ld banned."; // Need Übersetzung #elif L==3 // en - "Post %u banned."; + "Post %ld banned."; #elif L==4 // es - "Comentario %u no permitido"; + "Comentario %ld no permitido"; #elif L==5 // fr - "Post %u banned."; // Besoin de traduction + "Post %ld banned."; // Besoin de traduction #elif L==6 // gn - "Comentario %u no permitido"; // Okoteve traducción + "Comentario %ld no permitido"; // Okoteve traducción #elif L==7 // it - "Post %u censurato."; + "Post %ld censurato."; #elif L==8 // pl - "Post %u zakazany."; + "Post %ld zakazany."; #elif L==9 // pt - "Post %u não permitido."; + "Post %ld não permitido."; #endif -const char *Txt_FORUM_Post_X_banned_Click_to_unban_it = // Warning: it is very important to include %u in the following sentences +const char *Txt_FORUM_Post_X_banned_Click_to_unban_it = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Comentario %u no permitido. Pulse para permitirlo."; // Necessita traduccio + "Comentario %ld no permitido. Pulse para permitirlo."; // Necessita traduccio #elif L==2 // de - "Post %u banned. Click to unban it."; // Need Übersetzung + "Post %ld banned. Click to unban it."; // Need Übersetzung #elif L==3 // en - "Post %u banned. Click to unban it."; + "Post %ld banned. Click to unban it."; #elif L==4 // es - "Comentario %u no permitido. Pulse para permitirlo."; + "Comentario %ld no permitido. Pulse para permitirlo."; #elif L==5 // fr - "Post %u banned. Click to unban it."; // Besoin de traduction + "Post %ld banned. Click to unban it."; // Besoin de traduction #elif L==6 // gn - "Comentario %u no permitido. Pulse para permitirlo."; // Okoteve traducción + "Comentario %ld no permitido. Pulse para permitirlo."; // Okoteve traducción #elif L==7 // it - "Post %u censurato. Clicca per autorizzarlo."; + "Post %ld censurato. Clicca per autorizzarlo."; #elif L==8 // pl - "Post %u zakazany.Kliknij, aby to odbanowac."; + "Post %ld zakazany.Kliknij, aby to odbanowac."; #elif L==9 // pt - "Post %u não permitido. Clique para permiti-lo."; + "Post %ld não permitido. Clique para permiti-lo."; #endif const char *Txt_FORUM_Post_sent = @@ -31614,7 +31614,7 @@ const char *Txt_Question = "Questão"; #endif -const char *Txt_Question_code_X = // Warning: it is very important to include %s in the following sentences +const char *Txt_Question_code_X = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca "Pregunta amb codi %ld"; #elif L==2 // de @@ -38546,25 +38546,25 @@ const char *Txt_See_only_the_latest_COMMENTS = "Ver apenas os últimos"; #endif -const char *Txt_See_the_previous_X_COMMENTS = // Warning: it is very important to include %u in the following sentences +const char *Txt_See_the_previous_X_COMMENTS = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Veure els %u anteriors"; + "Veure els %ld anteriors"; #elif L==2 // de - "Siehe die vorherigen %u"; + "Siehe die vorherigen %ld"; #elif L==3 // en - "See the previous %u"; + "See the previous %ld"; #elif L==4 // es - "Ver los %u anteriores"; + "Ver los %ld anteriores"; #elif L==5 // fr - "Voir les %u précédents"; + "Voir les %ld précédents"; #elif L==6 // gn - "Ver los %u anteriores"; // Okoteve traducción + "Ver los %ld anteriores"; // Okoteve traducción #elif L==7 // it - "Vedi i precedente %u"; + "Vedi i precedente %ld"; #elif L==8 // pl - "Zobacz poprzednie %u"; + "Zobacz poprzednie %ld"; #elif L==9 // pt - "Ver os %u anteriores"; + "Ver os %ld anteriores"; #endif const char *Txt_Select_another_country = @@ -39878,25 +39878,25 @@ const char *Txt_Show_more_recipients = "Ver mais destinatários"; #endif -const char *Txt_Show_next_X_clicks = // Warning: it is very important to include %lu in the following sentences +const char *Txt_Show_next_X_clicks = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Mostrar %lu clics posteriores"; // Necessita traduccio + "Mostrar %ld clics posteriores"; // Necessita traduccio #elif L==2 // de - "Show next %lu clicks"; // Need Übersetzung + "Show next %ld clicks"; // Need Übersetzung #elif L==3 // en - "Show next %lu clicks"; + "Show next %ld clicks"; #elif L==4 // es - "Mostrar %lu clics posteriores"; + "Mostrar %ld clics posteriores"; #elif L==5 // fr - "Show next %lu clicks"; // Besoin de traduction + "Show next %ld clicks"; // Besoin de traduction #elif L==6 // gn - "Mostrar %lu clics posteriores"; // Okoteve traducción + "Mostrar %ld clics posteriores"; // Okoteve traducción #elif L==7 // it - "Mostra %lu scatti seguenti"; + "Mostra %ld scatti seguenti"; #elif L==8 // pl - "Show next %lu clicks"; // Potrzebujesz tlumaczenie + "Show next %ld clicks"; // Potrzebujesz tlumaczenie #elif L==9 // pt - "Mostrar %lu cliques subsequentes"; + "Mostrar %ld cliques subsequentes"; #endif const char *Txt_Show_office_hours = @@ -39920,25 +39920,25 @@ const char *Txt_Show_office_hours = "Mostrar horários tutor"; #endif -const char *Txt_Show_previous_X_clicks = // Warning: it is very important to include %u in the following sentences +const char *Txt_Show_previous_X_clicks = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Mostrar %u clics anteriores"; // Necessita traduccio + "Mostrar %ld clics anteriores"; // Necessita traduccio #elif L==2 // de - "Show previous %u clicks"; // Need Übersetzung + "Show previous %ld clicks"; // Need Übersetzung #elif L==3 // en - "Show previous %u clicks"; + "Show previous %ld clicks"; #elif L==4 // es - "Mostrar %u clics anteriores"; + "Mostrar %ld clics anteriores"; #elif L==5 // fr - "Show previous %u clicks"; // Besoin de traduction + "Show previous %ld clicks"; // Besoin de traduction #elif L==6 // gn - "Mostrar %u clics anteriores"; // Okoteve traducción + "Mostrar %ld clics anteriores"; // Okoteve traducción #elif L==7 // it - "Mostra %u scatti precedenti"; + "Mostra %ld scatti precedenti"; #elif L==8 // pl - "Show previous %u clicks"; // Potrzebujesz tlumaczenie + "Show previous %ld clicks"; // Potrzebujesz tlumaczenie #elif L==9 // pt - "Mostrar %u cliques anteriores"; + "Mostrar %ld cliques anteriores"; #endif const char *Txt_Show_questions = @@ -50149,25 +50149,25 @@ const char *Txt_TIMELINE_NOTE_Favourite = "Favorito"; #endif -const char *Txt_TIMELINE_NOTE_Favourited_by_X_USERS = // Warning: it is very important to include %u in the following sentences +const char *Txt_TIMELINE_NOTE_Favourited_by_X_USERS = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Marcat com favorit per %u"; + "Marcat com favorit per %ld"; #elif L==2 // de - "Von %u vorgemerkt"; + "Von %ld vorgemerkt"; #elif L==3 // en - "Favourited by %u"; + "Favourited by %ld"; #elif L==4 // es - "Marcado como favorito por %u"; + "Marcado como favorito por %ld"; #elif L==5 // fr - "Ajouté aux favoris par %u"; + "Ajouté aux favoris par %ld"; #elif L==6 // gn - "Marcado como favorito por %u"; // Okoteve traducción + "Marcado como favorito por %ld"; // Okoteve traducción #elif L==7 // it - "Preferiti da %u"; + "Preferiti da %ld"; #elif L==8 // pl - "Dodane do ulubionych przez %u"; + "Dodane do ulubionych przez %ld"; #elif L==9 // pt - "Marcado como favorito por %u"; + "Marcado como favorito por %ld"; #endif const char *Txt_TIMELINE_NOTE_Shared = @@ -50191,25 +50191,25 @@ const char *Txt_TIMELINE_NOTE_Shared = "Compartilhado"; #endif -const char *Txt_TIMELINE_NOTE_Shared_by_X_USERS = // Warning: it is very important to include %u in the following sentences +const char *Txt_TIMELINE_NOTE_Shared_by_X_USERS = // Warning: it is very important to include %ld in the following sentences #if L==1 // ca - "Compartit per %u"; + "Compartit per %ld"; #elif L==2 // de - "Von %u geteilt"; + "Von %ld geteilt"; #elif L==3 // en - "Shared by %u"; + "Shared by %ld"; #elif L==4 // es - "Compartido por %u"; + "Compartido por %ld"; #elif L==5 // fr - "Partagé par %u"; + "Partagé par %ld"; #elif L==6 // gn - "Compartido por %u"; // Okoteve traducción + "Compartido por %ld"; // Okoteve traducción #elif L==7 // it - "Condiviso da %u"; + "Condiviso da %ld"; #elif L==8 // pl - "Udostępnione przez %u"; + "Udostępnione przez %ld"; #elif L==9 // pt - "Compartilhado por %u"; + "Compartilhado por %ld"; #endif const char *Txt_TIMELINE_NOTE_Not_favourited_by_anyone = // No longer shared diff --git a/swad_timeline.c b/swad_timeline.c index 1d439106..4c2f2275 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -507,10 +507,10 @@ static void TL_ShowTimelineUsrHighlightingNot (long NotCod) TL_GET_RECENT_TIMELINE); /***** Show timeline *****/ - TL_ShowTimeline (Query,Str_BuildStrMsg (Txt_Timeline_OF_A_USER, + TL_ShowTimeline (Query,Str_BuildMsgStr (Txt_Timeline_OF_A_USER, Gbl.Usrs.Other.UsrDat.FirstName), NotCod); - Str_FreeStrMsg (); + Str_FreeMsg (); /***** Drop temporary tables *****/ TL_DropTemporaryTablesUsedToQueryTimeline (); @@ -2776,11 +2776,11 @@ static void TL_FormToShowHiddenComments (Act_Action_t ActionGbl,Act_Action_t Act } /* Put icon and text with link to show the first hidden comments */ - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_See_the_previous_X_COMMENTS, - NumInitialComments); HTM_BUTTON_SUBMIT_Begin (NULL,The_ClassFormLinkInBox[Gbl.Prefs.Theme],NULL); - Ico_PutIconTextLink ("angle-up.svg",Gbl.Title); + Ico_PutIconTextLink ("angle-up.svg", + Str_BuildMsgLong (Txt_See_the_previous_X_COMMENTS, + (long) NumInitialComments)); + Str_FreeMsg (); HTM_BUTTON_End (); /* End form */ @@ -2926,16 +2926,14 @@ static void TL_LinkToShowPreviousComments (const char IdComments[Frm_MAX_BYTES_I { extern const char *Txt_See_the_previous_X_COMMENTS; - /***** Build text to show *****/ - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_See_the_previous_X_COMMENTS, - NumInitialComments); - /***** Icon and text to show only the latest comments ****/ HTM_DIV_Begin ("id=\"exp_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\"" " style=\"display:none;\"", // Hidden IdComments); - TL_PutIconToToggleComments (IdComments,"angle-up.svg",Gbl.Title); + TL_PutIconToToggleComments (IdComments,"angle-up.svg", + Str_BuildMsgLong (Txt_See_the_previous_X_COMMENTS, + (long) NumInitialComments)); + Str_FreeMsg (); HTM_DIV_End (); } @@ -3124,11 +3122,10 @@ static void TL_PutDisabledIconShare (unsigned NumShared) /***** Disabled icon to share *****/ if (NumShared) { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_TIMELINE_NOTE_Shared_by_X_USERS, - NumShared); Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE, - Gbl.Title); + Str_BuildMsgLong (Txt_TIMELINE_NOTE_Shared_by_X_USERS, + (long) NumShared)); + Str_FreeMsg (); } else Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE, @@ -3147,11 +3144,10 @@ static void TL_PutDisabledIconFav (unsigned NumFavs) /***** Disabled icon to mark as favourite *****/ if (NumFavs) { - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_TIMELINE_NOTE_Favourited_by_X_USERS, - NumFavs); Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_FAV, - Gbl.Title); + Str_BuildMsgLong (Txt_TIMELINE_NOTE_Favourited_by_X_USERS, + (long) NumFavs)); + Str_FreeMsg (); } else Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_FAV,