diff --git a/swad_changelog.h b/swad_changelog.h index 2494ceee8..b6e852bcb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -402,10 +402,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.46.3 (2019-02-16)" +#define Log_PLATFORM_VERSION "SWAD 18.46.4 (2019-02-16)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.46.4: Feb 16, 2019 Refactoring code related to alerts. (238061 lines) Version 18.46.3: Feb 16, 2019 Refactoring code related to alerts. (238243 lines) Version 18.46.2: Feb 16, 2019 Refactoring code related to alerts. (238298 lines) Version 18.46.1: Feb 15, 2019 Refactoring code related to alerts. (238355 lines) diff --git a/swad_degree.c b/swad_degree.c index 57e1b35b4..a712c490d 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -228,7 +228,7 @@ void Deg_SeeDegWithPendingCrss (void) Box_EndBoxTable (); } else - Ale_ShowA_old (Ale_INFO,Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed); + Ale_ShowA_fmt (Ale_INFO,Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1202,7 +1202,7 @@ static void Deg_ListDegrees (void) Tbl_EndTable (); } else // No degrees created in the current centre - Ale_ShowA_old (Ale_INFO,Txt_No_degrees); + Ale_ShowA_fmt (Ale_INFO,Txt_No_degrees); /***** Button to create degree *****/ if (Deg_CheckIfICanCreateDegrees ()) @@ -1376,7 +1376,7 @@ void Deg_EditDegrees (void) else // No degree types { /***** Warning message *****/ - Ale_ShowA_old (Ale_WARNING,Txt_No_types_of_degree); + Ale_ShowA_fmt (Ale_WARNING,Txt_No_types_of_degree); /***** Form to create the first degree type *****/ if (DT_CheckIfICanCreateDegreeTypes ()) @@ -1579,27 +1579,19 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status) { /***** If name of degree was in database... *****/ if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Degs.EditingDeg.ShrtName,-1L,Gbl.Degs.EditingDeg.CtrCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_degree_X_already_exists, - Gbl.Degs.EditingDeg.ShrtName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_The_degree_X_already_exists, + Gbl.Degs.EditingDeg.ShrtName); else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.Degs.EditingDeg.FullName,-1L,Gbl.Degs.EditingDeg.CtrCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_degree_X_already_exists, - Gbl.Degs.EditingDeg.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_The_degree_X_already_exists, + Gbl.Degs.EditingDeg.FullName); else // Add new degree to database Deg_CreateDegree (Status); } else // If there is not a degree logo or web - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_degree); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_degree); } else // If there is not a degree name - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); /***** Show the form again *****/ Deg_EditDegrees (); @@ -1623,17 +1615,15 @@ void Deg_RemoveDegree (void) /***** Check if this degree has courses *****/ if (Crs_GetNumCrssInDeg (Deg.DegCod)) // Degree has courses ==> don't remove - Ale_ShowA_old (Ale_WARNING,Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree); + Ale_ShowA_fmt (Ale_WARNING,Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree); else // Degree has no courses ==> remove it { /***** Remove degree *****/ Deg_RemoveDegreeCompletely (Deg.DegCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Degree_X_removed, - Deg.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Degree_X_removed, + Deg.FullName); } /***** Show the form again *****/ @@ -2173,7 +2163,7 @@ void Deg_ChangeDegWWW (void) Deg_ShowAlertAndButtonToGoToDeg (); } else - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Deg_EditDegrees (); @@ -2198,13 +2188,11 @@ void Deg_ChangeDegWWWInConfig (void) Cns_MAX_BYTES_WWW); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_new_web_address_is_X, - NewWWW); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_new_web_address_is_X, + NewWWW); } else - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Deg_ShowConfiguration (); @@ -2307,7 +2295,7 @@ void Deg_ShowAlertAndButtonToGoToDeg (void) } else /***** Alert *****/ - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowA_new (Gbl.AlertToShowLater.Type,Gbl.AlertToShowLater.Txt); } static void Deg_PutParamGoToDeg (void) diff --git a/swad_department.c b/swad_department.c index b94639134..f1b560e44 100644 --- a/swad_department.c +++ b/swad_department.c @@ -613,7 +613,7 @@ void Dpt_RemoveDepartment (void) /***** Check if this department has teachers *****/ if (Dpt.NumTchs) // Department has teachers ==> don't remove - Ale_ShowA_old (Ale_WARNING,Txt_To_remove_a_department_you_must_first_remove_all_teachers_in_the_department); + Ale_ShowA_fmt (Ale_WARNING,Txt_To_remove_a_department_you_must_first_remove_all_teachers_in_the_department); else // Department has no teachers ==> remove it { /***** Remove department *****/ @@ -622,10 +622,8 @@ void Dpt_RemoveDepartment (void) Dpt.DptCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Department_X_removed, - Dpt.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Department_X_removed, + Dpt.FullName); } /***** Show the form again *****/ @@ -656,7 +654,7 @@ void Dpt_ChangeDepartIns (void) Dpt->InsCod,Dpt->DptCod); /***** Write message to show the change made *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed); /***** Show the form again *****/ Dpt_EditDepartments (); @@ -726,12 +724,8 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName) /***** Check if new name is empty *****/ if (!NewDptName[0]) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_can_not_leave_the_name_of_the_department_X_empty, - CurrentDptName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_You_can_not_leave_the_name_of_the_department_X_empty, + CurrentDptName); else { /***** Check if old and new names are the same @@ -740,31 +734,21 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName) { /***** If degree was in database... *****/ if (Dpt_CheckIfDepartmentNameExists (ParamName,NewDptName,Dpt->DptCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_department_X_already_exists, - NewDptName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_The_department_X_already_exists, + NewDptName); else { /* Update the table changing old name by new name */ Dpt_UpdateDegNameDB (Dpt->DptCod,FieldName,NewDptName); /* Write message to show the change made */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_department_X_has_been_renamed_as_Y, - CurrentDptName,NewDptName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_department_X_has_been_renamed_as_Y, + CurrentDptName,NewDptName); } } else // The same name - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_name_of_the_department_X_has_not_changed, - CurrentDptName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_INFO,Txt_The_name_of_the_department_X_has_not_changed, + CurrentDptName); } /***** Show the form again *****/ @@ -828,13 +812,11 @@ void Dpt_ChangeDptWWW (void) NewWWW,Dpt->DptCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_new_web_address_is_X, - NewWWW); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_new_web_address_is_X, + NewWWW); } else - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Str_Copy (Dpt->WWW,NewWWW, @@ -1017,27 +999,19 @@ void Dpt_RecFormNewDpt (void) { /***** If name of department was in database... *****/ if (Dpt_CheckIfDepartmentNameExists ("ShortName",Dpt->ShrtName,-1L)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_department_X_already_exists, - Dpt->ShrtName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_The_department_X_already_exists, + Dpt->ShrtName); else if (Dpt_CheckIfDepartmentNameExists ("FullName",Dpt->FullName,-1L)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_department_X_already_exists, - Dpt->FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_The_department_X_already_exists, + Dpt->FullName); else // Add new department to database Dpt_CreateDepartment (Dpt); } else // If there is not a web - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_department); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_department); } else // If there is not a department name - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_department); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_department); /***** Show the form again *****/ Dpt_EditDepartments (); @@ -1060,10 +1034,8 @@ static void Dpt_CreateDepartment (struct Department *Dpt) Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW); /***** Write success message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Created_new_department_X, - Dpt->FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Created_new_department_X, + Dpt->FullName); } /*****************************************************************************/ diff --git a/swad_duplicate.c b/swad_duplicate.c index 3eb4e6b14..b0ab2a0b1 100644 --- a/swad_duplicate.c +++ b/swad_duplicate.c @@ -102,13 +102,13 @@ void Dup_ReportUsrAsPossibleDuplicate (void) Gbl.Usrs.Me.UsrDat.UsrCod); /***** Show feedback message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ @@ -250,7 +250,7 @@ void Dup_GetUsrCodAndListSimilarUsrs (void) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) Dup_ListSimilarUsrs (); else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } static void Dup_ListSimilarUsrs (void) @@ -459,7 +459,7 @@ void Dup_RemoveUsrFromListDupUsrs (void) Dup_ListDuplicateUsrs (); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 0b38ee646..1d31ea0e0 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -394,11 +394,9 @@ void Enr_ReqAcceptRegisterInCrs (void) Hlp_USERS_SignUp_confirm_enrolment,Box_NOT_CLOSABLE); /***** Show message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y, - Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y, + Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], + Gbl.CurrentCrs.Crs.FullName); /***** Send button to accept register in the current course *****/ switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role) @@ -627,7 +625,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role) Enr_ReqAnotherUsrIDToRegisterRemove (Role); break; default: - Ale_ShowA_old (Ale_ERROR,Txt_You_dont_have_permission_to_perform_this_action); + Ale_ShowA_fmt (Ale_ERROR,Txt_You_dont_have_permission_to_perform_this_action); break; } } @@ -721,7 +719,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) The_ClassTitle[Gbl.Prefs.Theme], Txt_Step_1_Provide_a_list_of_users); - Ale_ShowA_old (Ale_INFO,Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_); + Ale_ShowA_fmt (Ale_INFO,Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_); Enr_PutAreaToEnterUsrsIDs (); /***** Step 2: Put different actions to register/remove users to/from current course *****/ @@ -742,17 +740,13 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) { if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups? { - Ale_ShowA_old (Ale_INFO,Txt_Select_the_groups_in_from_which_you_want_to_register_remove_users_); + Ale_ShowA_fmt (Ale_INFO,Txt_Select_the_groups_in_from_which_you_want_to_register_remove_users_); Grp_ShowLstGrpsToChgOtherUsrsGrps (-1L); } else - { /* Write help message */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_No_groups_have_been_created_in_the_course_X_Therefore_, - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X_Therefore_, + Gbl.CurrentCrs.Crs.FullName); } /***** Step 4: Confirm register / remove students *****/ @@ -871,12 +865,10 @@ void Enr_RemoveOldUsrs (void) (unsigned long) SecondsWithoutAccess); if (NumUsrs) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Eliminating_X_users_who_were_not_enroled_in_any_course_and_with_more_than_Y_months_without_access_to_Z, - NumUsrs, - MonthsWithoutAccess, - Cfg_PLATFORM_SHORT_NAME); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_Eliminating_X_users_who_were_not_enroled_in_any_course_and_with_more_than_Y_months_without_access_to_Z, + NumUsrs, + MonthsWithoutAccess, + Cfg_PLATFORM_SHORT_NAME); /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); @@ -906,10 +898,8 @@ void Enr_RemoveOldUsrs (void) } /***** Write end message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_X_users_have_been_eliminated, - NumUsrsEliminated); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_X_users_have_been_eliminated, + NumUsrsEliminated); } /*****************************************************************************/ @@ -1509,7 +1499,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) if (!Grp_CheckIfSelectionGrpsSingleEnrolmentIsValid (Role,&LstGrps)) { /* Show warning message and exit */ - Ale_ShowA_old (Ale_WARNING,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group); + Ale_ShowA_fmt (Ale_WARNING,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group); /* Free memory used by lists of groups and abort */ Grp_FreeListCodGrp (&LstGrps); @@ -1746,32 +1736,28 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) switch (NumUsrsEliminated) { case 0: - Ale_ShowA_old (Ale_INFO,Txt_No_user_has_been_eliminated); + Ale_ShowA_fmt (Ale_INFO,Txt_No_user_has_been_eliminated); break; case 1: - Ale_ShowA_old (Ale_SUCCESS,Txt_One_user_has_been_eliminated); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_One_user_has_been_eliminated); break; default: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_X_users_have_been_eliminated, - NumUsrsEliminated); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_X_users_have_been_eliminated, + NumUsrsEliminated); break; } else // Only remove from course / groups switch (NumUsrsRemoved) { case 0: - Ale_ShowA_old (Ale_INFO,Txt_No_user_has_been_removed); + Ale_ShowA_fmt (Ale_INFO,Txt_No_user_has_been_removed); break; case 1: - Ale_ShowA_old (Ale_SUCCESS,Txt_One_user_has_been_removed); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_One_user_has_been_removed); break; default: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_X_users_have_been_removed, - NumUsrsRemoved); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_X_users_have_been_removed, + NumUsrsRemoved); break; } } @@ -1779,16 +1765,14 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) switch (NumUsrsRegistered) { case 0: - Ale_ShowA_old (Ale_INFO,Txt_No_user_has_been_enroled); + Ale_ShowA_fmt (Ale_INFO,Txt_No_user_has_been_enroled); break; case 1: - Ale_ShowA_old (Ale_SUCCESS,Txt_One_user_has_been_enroled); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_One_user_has_been_enroled); break; default: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_X_users_have_been_enroled_including_possible_repetitions, - NumUsrsRegistered); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_X_users_have_been_enroled_including_possible_repetitions, + NumUsrsRegistered); break; } @@ -1919,12 +1903,8 @@ void Enr_RemAllStdsThisCrs (void) if (Pwd_GetConfirmationOnDangerousAction ()) { if ((NumStdsInCrs = Enr_RemAllStdsInCrs (&Gbl.CurrentCrs.Crs))) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_X_students_who_belonged_to_the_course_Y_have_been_removed_from_it, - NumStdsInCrs,Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_X_students_who_belonged_to_the_course_Y_have_been_removed_from_it, + NumStdsInCrs,Gbl.CurrentCrs.Crs.FullName); else // NumStdsInCrs == 0 /***** Show warning indicating no students found *****/ Usr_ShowWarningNoUsersFound (Rol_STD); @@ -1973,13 +1953,9 @@ void Enr_ReqSignUpInCrs (void) /***** Check if I already belong to course *****/ if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_were_already_enroled_as_X_in_the_course_Y, - Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y, + Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], + Gbl.CurrentCrs.Crs.FullName); else if (Gbl.Usrs.Me.Role.Logged == Rol_GST || Gbl.Usrs.Me.Role.Logged == Rol_USR) /***** Show form to modify only the user's role or the user's data *****/ @@ -2004,13 +1980,9 @@ void Enr_SignUpInCrs (void) /***** Check if I already belong to course *****/ if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_were_already_enroled_as_X_in_the_course_Y, - Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y, + Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], + Gbl.CurrentCrs.Crs.FullName); else { /***** Get new role from record form *****/ @@ -2061,11 +2033,9 @@ void Enr_SignUpInCrs (void) (unsigned) RoleFromForm); /***** Show confirmation message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Your_request_for_enrolment_as_X_in_the_course_Y_has_been_accepted_for_processing, - Txt_ROLES_SINGUL_abc[RoleFromForm][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Your_request_for_enrolment_as_X_in_the_course_Y_has_been_accepted_for_processing, + Txt_ROLES_SINGUL_abc[RoleFromForm][Gbl.Usrs.Me.UsrDat.Sex], + Gbl.CurrentCrs.Crs.FullName); /***** Notify teachers or admins by email about the new enrolment request *****/ // If this course has teachers ==> send notification to teachers @@ -2152,10 +2122,8 @@ void Enr_AskIfRejectSignUp (void) if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat)) { /* User already belongs to this course */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, + Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); /* Remove inscription request because it has not sense */ @@ -2190,7 +2158,7 @@ void Enr_AskIfRejectSignUp (void) } } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ @@ -2211,10 +2179,8 @@ void Enr_RejectSignUp (void) if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat)) { /* User already belongs to this course */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, + Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); } @@ -2222,13 +2188,11 @@ void Enr_RejectSignUp (void) Enr_RemoveEnrolmentRequest (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); /* Confirmation message */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Enrolment_of_X_rejected, - Gbl.Usrs.Other.UsrDat.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Enrolment_of_X_rejected, + Gbl.Usrs.Other.UsrDat.FullName); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); /* Show again the rest of registrarion requests */ Enr_ShowEnrolmentRequests (); @@ -3008,7 +2972,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) Usr_UsrDataDestructor (&UsrDat); } else // There are no requests - Ale_ShowA_old (Ale_INFO,Txt_No_enrolment_requests); + Ale_ShowA_fmt (Ale_INFO,Txt_No_enrolment_requests); /***** End box *****/ Box_EndBox (); @@ -3287,12 +3251,8 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role) { /***** Warning if more than one user found *****/ if (ListUsrCods->NumUsrs > 1) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_are_X_users_with_the_ID_Y, - ListUsrCods->NumUsrs,Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_INFO,Txt_There_are_X_users_with_the_ID_Y, + ListUsrCods->NumUsrs,Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail); /***** For each user found... *****/ for (NumUsr = 0; @@ -3310,34 +3270,27 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role) { Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); if (Gbl.Usrs.Other.UsrDat.Accepted) - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); + Ale_ShowA_fmt (Ale_INFO,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, + Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); else // Enrolment not yet accepted - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_in_the_course_Y_but_has_not_yet_accepted_the_enrolment, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_THE_USER_X_is_already_in_the_course_Y_but_has_not_yet_accepted_the_enrolment, + Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Enr_ShowFormToEditOtherUsr (); } else // User does not belong to the current course { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_already_exists_in_Y_but_is_not_yet_enroled_in_the_course_Z, - Gbl.Usrs.Other.UsrDat.FullName, - Cfg_PLATFORM_SHORT_NAME,Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_THE_USER_X_already_exists_in_Y_but_is_not_yet_enroled_in_the_course_Z, + Gbl.Usrs.Other.UsrDat.FullName, + Cfg_PLATFORM_SHORT_NAME,Gbl.CurrentCrs.Crs.FullName); Enr_ShowFormToEditOtherUsr (); } } else // No course selected { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_already_exists_in_Y, - Gbl.Usrs.Other.UsrDat.FullName,Cfg_PLATFORM_SHORT_NAME); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_THE_USER_X_already_exists_in_Y, + Gbl.Usrs.Other.UsrDat.FullName,Cfg_PLATFORM_SHORT_NAME); Enr_ShowFormToEditOtherUsr (); } @@ -3358,19 +3311,15 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role) if (NewUsrIDValid) { /***** Show form to enter the data of a new user *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_user_is_new_not_yet_in_X, - Cfg_PLATFORM_SHORT_NAME); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_The_user_is_new_not_yet_in_X, + Cfg_PLATFORM_SHORT_NAME); Rec_ShowFormOtherNewSharedRecord (&Gbl.Usrs.Other.UsrDat,Role); } else // User's ID is not valid { /* Write message and request a new user's ID */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_If_this_is_a_new_user_in_X_you_should_indicate_her_his_ID, - Cfg_PLATFORM_SHORT_NAME); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,Txt_If_this_is_a_new_user_in_X_you_should_indicate_her_his_ID, + Cfg_PLATFORM_SHORT_NAME); Enr_ReqRegRemUsr (Role); } } @@ -3442,10 +3391,10 @@ static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName) Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } } @@ -3461,9 +3410,8 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,long Cod /***** Check if user was and administrator of current institution/centre/degree *****/ if (Usr_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_an_administrator_of_Y, - UsrDat->FullName,InsCtrDegName); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_THE_USER_X_is_already_an_administrator_of_Y, + UsrDat->FullName,InsCtrDegName); else // User was not administrator of current institution/centre/degree { /***** Insert or replace administrator in current institution/centre/degree *****/ @@ -3474,11 +3422,9 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,long Cod " (%ld,'%s',%ld)", UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y, - UsrDat->FullName,InsCtrDegName); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y, + UsrDat->FullName,InsCtrDegName); } - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); } /*****************************************************************************/ @@ -3504,10 +3450,10 @@ void Enr_ReqRemUsrFromCrs (void) if (Enr_CheckIfICanRemUsrFromCrs ()) Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat); else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ @@ -3528,15 +3474,15 @@ void Enr_RemUsrFromCrs1 (void) Enr_REMOVE_WORKS,Cns_VERBOSE); else { - Gbl.Alert.Type = Ale_WARNING; - Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Gbl.AlertToShowLater.Type = Ale_WARNING; + Str_Copy (Gbl.AlertToShowLater.Txt,Txt_User_not_found_or_you_do_not_have_permission_, Ale_MAX_BYTES_ALERT); } } else { - Gbl.Alert.Type = Ale_WARNING; - Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Gbl.AlertToShowLater.Type = Ale_WARNING; + Str_Copy (Gbl.AlertToShowLater.Txt,Txt_User_not_found_or_you_do_not_have_permission_, Ale_MAX_BYTES_ALERT); } } @@ -3544,7 +3490,7 @@ void Enr_RemUsrFromCrs1 (void) void Enr_RemUsrFromCrs2 (void) { - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowA_new (Gbl.AlertToShowLater.Type,Gbl.AlertToShowLater.Txt); } /*****************************************************************************/ @@ -3674,18 +3620,14 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t } } else // The other user is not an administrator of current institution - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_not_an_administrator_of_Y, - Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_WARNING,Txt_THE_USER_X_is_not_an_administrator_of_Y, + Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } } @@ -3724,10 +3666,8 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName) { if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/centre/degree { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_already_an_administrator_of_Y, - Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_THE_USER_X_is_already_an_administrator_of_Y, + Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); } else @@ -3749,10 +3689,10 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName) } } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } } @@ -3775,10 +3715,8 @@ void Enr_AcceptRegisterMeInCrs (void) Gbl.Usrs.Me.UsrDat.UsrCod); /***** Confirmation message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_have_confirmed_your_enrolment_in_the_course_X, - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_You_have_confirmed_your_enrolment_in_the_course_X, + Gbl.CurrentCrs.Crs.FullName); } /*****************************************************************************/ @@ -4070,7 +4008,7 @@ void Enr_ModifyUsr2 (void) extern const char *Txt_User_not_found_or_you_do_not_have_permission_; if (Gbl.Alert.Type == Ale_WARNING) - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); else // No error switch (Gbl.Usrs.RegRemAction) { @@ -4187,7 +4125,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat) Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); } else // User does not belong to current course - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowA_fmt (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ @@ -4347,16 +4285,10 @@ static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope, " WHERE UsrCod=%ld AND Scope='%s' AND Cod=%ld", UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_as_administrator_of_Y, - UsrDat->FullName,InsCtrDegName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_as_administrator_of_Y, + UsrDat->FullName,InsCtrDegName); } else // User is not an administrator of the current institution/centre/degree - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_is_not_an_administrator_of_Y, - UsrDat->FullName,InsCtrDegName); - Ale_ShowA_old (Ale_ERROR,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_ERROR,Txt_THE_USER_X_is_not_an_administrator_of_Y, + UsrDat->FullName,InsCtrDegName); } diff --git a/swad_exam.c b/swad_exam.c index 97cdd1cf4..61f6ed680 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -295,9 +295,9 @@ void Exa_ReceiveExamAnnouncement2 (void) struct SocialPublishing SocPub; /***** Show message *****/ - Ale_ShowA_old (Ale_SUCCESS, + Ale_ShowA_fmt (Ale_SUCCESS, Gbl.ExamAnns.NewExamAnnouncement ? Txt_Created_new_announcement_of_exam : - Txt_The_announcement_of_exam_has_been_successfully_updated); + Txt_The_announcement_of_exam_has_been_successfully_updated); /***** Notify by email about the new exam announcement *****/ if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_EXAM_ANNOUNCEMENT,Gbl.ExamAnns.ExaDat.ExaCod))) @@ -414,7 +414,7 @@ void Exa_RemoveExamAnnouncement2 (void) extern const char *Txt_Announcement_of_exam_removed; /***** Write message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Announcement_of_exam_removed); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Announcement_of_exam_removed); /***** List again all the remaining exam announcements *****/ Exa_ListExamAnnouncementsEdit (); @@ -447,7 +447,7 @@ void Exa_HideExamAnnouncement2 (void) extern const char *Txt_The_announcement_of_exam_is_now_hidden; /***** Write message to show the change made *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_announcement_of_exam_is_now_hidden); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_announcement_of_exam_is_now_hidden); /***** Show exam announcements again *****/ Exa_ListExamAnnouncementsEdit (); @@ -480,7 +480,7 @@ void Exa_UnhideExamAnnouncement2 (void) extern const char *Txt_The_announcement_of_exam_is_now_visible; /***** Write message to show the change made *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_announcement_of_exam_is_now_visible); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_The_announcement_of_exam_is_now_visible); /***** Show exam announcements again *****/ Exa_ListExamAnnouncementsEdit (); @@ -657,12 +657,8 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx /***** The result of the query may be empty *****/ if (!NumExaAnns) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_No_announcements_of_exams_of_X, - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowA_fmt (Ale_INFO,Txt_No_announcements_of_exams_of_X, + Gbl.CurrentCrs.Crs.FullName); /***** List the existing exam announcements *****/ for (NumExaAnn = 0; diff --git a/swad_file_browser.c b/swad_file_browser.c index fac4f737b..fd173c18b 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -2820,7 +2820,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con NewFolderName); if (rename (PathOldFolder,PathNewFolder)) // Fail { - Ale_ShowA_old (Ale_ERROR,Txt_Can_not_rename_a_folder_of_assignment); + Ale_ShowA_fmt (Ale_ERROR,Txt_Can_not_rename_a_folder_of_assignment); NumUsrsError++; } else // Success @@ -2847,18 +2847,16 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con } /***** Summary message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s: %u
" - "%s: %u
" - "%s: %u.", - Txt_Users,NumUsrs, - Txt_Folders_renamed,NumUsrsSuccess, - Txt_Folders_not_renamed,NumUsrsError); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,"%s: %u
" + "%s: %u
" + "%s: %u.", + Txt_Users,NumUsrs, + Txt_Folders_renamed,NumUsrsSuccess, + Txt_Folders_not_renamed,NumUsrsError); } else /***** Warning message *****/ - Ale_ShowA_old (Ale_WARNING,Txt_Can_not_rename_a_folder_of_assignment); + Ale_ShowA_fmt (Ale_WARNING,Txt_Can_not_rename_a_folder_of_assignment); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2923,7 +2921,7 @@ static void Brw_SetAndCheckQuota (void) Brw_SetMaxQuota (); Brw_CalcSizeOfDir (Gbl.FileBrowser.Priv.PathRootFolder); if (Brw_CheckIfQuotaExceded ()) - Ale_ShowA_old (Ale_WARNING,Txt_Quota_exceeded); + Ale_ShowA_fmt (Ale_WARNING,Txt_Quota_exceeded); } /*****************************************************************************/ @@ -3208,7 +3206,7 @@ static void Brw_ShowFileBrowserProject (void) } } else - Ale_ShowA_old (Ale_WARNING,"You have no access to project files."); + Ale_ShowA_fmt (Ale_WARNING,"You have no access to project files."); /***** End box *****/ Box_EndBox (); @@ -3280,7 +3278,7 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void) else // If no users are selected... { // ...write warning alert - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_users); + Ale_ShowA_fmt (Ale_WARNING,Txt_You_must_select_one_ore_more_users); // ...and show again the form Brw_AskEditWorksCrs (); } @@ -3535,18 +3533,16 @@ void Brw_ShowAgainFileBrowserOrWorks (void) { case Brw_ADMI_MRK_CRS: case Brw_ADMI_MRK_GRP: - Ale_ShowA_old (Ale_INFO,Txt_Files_of_marks_must_contain_a_table_in_HTML_format_); + Ale_ShowA_fmt (Ale_INFO,Txt_Files_of_marks_must_contain_a_table_in_HTML_format_); break; default: break; } /***** Legal notice *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Disclaimer_the_files_hosted_here_, - Cfg_PLATFORM_SHORT_NAME, - Cfg_PLATFORM_RESPONSIBLE_EMAIL); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_Disclaimer_the_files_hosted_here_, + Cfg_PLATFORM_SHORT_NAME, + Cfg_PLATFORM_RESPONSIBLE_EMAIL); } /*****************************************************************************/ @@ -6788,10 +6784,8 @@ void Brw_RemFileFromTree (void) Gbl.Usrs.Other.UsrDat.UsrCod); /* Message of confirmation of removing */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_FILE_X_removed, - FileNameToShow); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_FILE_X_removed, + FileNameToShow); } else // File / link not found Lay_ShowErrorAndExit ("File / link not found."); @@ -6847,10 +6841,8 @@ void Brw_RemFolderFromTree (void) Gbl.Usrs.Other.UsrDat.UsrCod); /* Message of confirmation of successfull removing */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Folder_X_removed, - Gbl.FileBrowser.FilFolLnkName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Folder_X_removed, + Gbl.FileBrowser.FilFolLnkName); } else // Folder not found Lay_ShowErrorAndExit ("Folder not found."); @@ -6928,10 +6920,8 @@ void Brw_RemSubtreeInFileBrowser (void) Brw_RemoveAffectedExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree); /***** Write message of confirmation *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Folder_X_and_all_its_contents_removed, - Gbl.FileBrowser.FilFolLnkName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,Txt_Folder_X_and_all_its_contents_removed, + Gbl.FileBrowser.FilFolLnkName); } /***** Show again file browser *****/ @@ -7242,20 +7232,16 @@ static void Brw_WriteCurrentClipboard (void) Gbl.FileBrowser.Clipboard.FileName, FileNameToShow); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s: %s, %s %s.", - Txt_Copy_source,TxtClipboardZone, - TxtFileType[Gbl.FileBrowser.Clipboard.FileType], - FileNameToShow); + Ale_ShowA_fmt (Ale_CLIPBOARD,"%s: %s, %s %s.", + Txt_Copy_source,TxtClipboardZone, + TxtFileType[Gbl.FileBrowser.Clipboard.FileType], + FileNameToShow); } else // The root folder - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s: %s, %s.", - Txt_Copy_source,TxtClipboardZone, - Txt_all_files_inside_the_root_folder); - - Ale_ShowA_old (Ale_CLIPBOARD,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_CLIPBOARD,"%s: %s, %s.", + Txt_Copy_source,TxtClipboardZone, + Txt_all_files_inside_the_root_folder); } /*****************************************************************************/ @@ -8003,7 +7989,7 @@ void Brw_PasteIntoFileBrowser (void) } else /***** Write message ******/ - Ale_ShowA_old (Ale_WARNING,Txt_Nothing_has_been_pasted_because_the_clipboard_is_empty_); + Ale_ShowA_fmt (Ale_WARNING,Txt_Nothing_has_been_pasted_because_the_clipboard_is_empty_); /***** Show again file browser *****/ Brw_ShowAgainFileBrowserOrWorks (); @@ -8194,16 +8180,14 @@ static void Brw_PasteClipboard (void) &FirstFilCod)) { /***** Write message of success *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s
" - "%s: %u
" - "%s: %u
" - "%s: %u", - Txt_The_copy_has_been_successful, - Txt_Files_copied ,Pasted.NumFiles, - Txt_Links_copied ,Pasted.NumLinks, - Txt_Folders_copied,Pasted.NumFolds); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_SUCCESS,"%s
" + "%s: %u
" + "%s: %u
" + "%s: %u", + Txt_The_copy_has_been_successful, + Txt_Files_copied ,Pasted.NumFiles, + Txt_Links_copied ,Pasted.NumLinks, + Txt_Folders_copied,Pasted.NumFolds); /***** Notify new files *****/ if (Pasted.NumFiles || @@ -8346,24 +8330,20 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg, switch (FileType) { case Brw_IS_FILE: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); + Ale_ShowA_fmt (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, + FileNameToShow); break; case Brw_IS_FOLDER: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); + Ale_ShowA_fmt (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, + FileNameToShow); break; case Brw_IS_LINK: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); + Ale_ShowA_fmt (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, + FileNameToShow); break; default: Lay_ShowErrorAndExit ("Can not paste unknown file type."); } - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); CopyIsGoingSuccessful = false; } else // Quota not exceeded @@ -8375,11 +8355,9 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg, /***** Check if exists the destination file */ if (Fil_CheckIfPathExists (PathDstWithFile)) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_there_is_already_an_object_with_that_name : - Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_there_is_already_an_object_with_that_name, - FileNameToShow); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_there_is_already_an_object_with_that_name : + Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_there_is_already_an_object_with_that_name, + FileNameToShow); CopyIsGoingSuccessful = false; } else // Destination file does not exist @@ -8394,10 +8372,8 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg, Mrk_CheckFileOfMarks (PathOrg,&Marks); // Gbl.Alert.Txt contains feedback text else { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML, - FileNameToShow); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML, + FileNameToShow); CopyIsGoingSuccessful = false; } } @@ -8409,11 +8385,9 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg, Gbl.FileBrowser.Size.TotalSiz += (unsigned long long) FileStatus.st_size; if (Brw_CheckIfQuotaExceded ()) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_disk_quota : - Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_disk_quota, - FileNameToShow); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_disk_quota : + Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_disk_quota, + FileNameToShow); CopyIsGoingSuccessful = false; } else // Quota not exceeded @@ -8453,10 +8427,8 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg, Gbl.FileBrowser.Size.TotalSiz += (unsigned long long) FileStatus.st_size; if (Brw_CheckIfQuotaExceded ()) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_disk_quota, - FileNameToShow); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_disk_quota, + FileNameToShow); CopyIsGoingSuccessful = false; } else // Quota not exceded @@ -8583,10 +8555,8 @@ static void Brw_PutFormToCreateAFolder (const char FileNameToShow[NAME_MAX + 1]) /***** Start box *****/ Box_StartBox (NULL,Txt_Create_folder,NULL, NULL,Box_NOT_CLOSABLE); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_can_create_a_new_folder_inside_the_folder_X, - FileNameToShow); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowA_fmt (Ale_INFO,Txt_You_can_create_a_new_folder_inside_the_folder_X, + FileNameToShow); /***** Folder *****/ fprintf (Gbl.F.Out,"