diff --git a/swad_ID.c b/swad_ID.c index 03a3cfd7..1507356e 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -592,11 +592,11 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, /***** Show possible alert *****/ if (Gbl.Alert.Section == (const char *) ID_ID_SECTION_ID) - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowDelayedAlert (); /***** Help message *****/ if (IShouldFillInID) - Ale_ShowA_old (Ale_WARNING,Txt_Please_fill_in_your_ID); + Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_ID); /***** Start table *****/ Tbl_StartTableWide (2); @@ -676,7 +676,7 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, /***** Write help text *****/ fprintf (Gbl.F.Out,"" ""); - Ale_ShowA_old (Ale_INFO,Txt_The_ID_is_used_in_order_to_facilitate_); + Ale_ShowAlert (Ale_INFO,Txt_The_ID_is_used_in_order_to_facilitate_); fprintf (Gbl.F.Out,"" ""); @@ -767,10 +767,10 @@ void ID_RemoveOtherUsrID (void) Acc_ShowFormChgOtherUsrAccount (); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else // User not found - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ @@ -898,10 +898,10 @@ void ID_NewOtherUsrID (void) Acc_ShowFormChgOtherUsrAccount (); } else - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } else // User not found - Ale_ShowA_old (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } /*****************************************************************************/ diff --git a/swad_assignment.c b/swad_assignment.c index ac4b91c7..26e5f1d8 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -1357,7 +1357,7 @@ void Asg_RecFormAssignment (void) else // Folder name not valid { NewAssignmentIsCorrect = false; - Ale_ShowDelayedAlert (Ale_WARNING,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } } else // NewAsg.SendWork == Asg_DO_NOT_SEND_WORK diff --git a/swad_centre.c b/swad_centre.c index a76f20c4..7604a73c 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -2259,7 +2259,7 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void) } else /***** Alert *****/ - Ale_ShowDelayedAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } static void Ctr_PutParamGoToCtr (void) diff --git a/swad_changelog.h b/swad_changelog.h index a7826949..517cad7b 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.5 (2019-02-16)" +#define Log_PLATFORM_VERSION "SWAD 18.46.6 (2019-02-16)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.46.6: Feb 16, 2019 Refactoring code related to alerts. (238019 lines) Version 18.46.5: Feb 16, 2019 Refactoring code related to alerts. (238062 lines) 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) diff --git a/swad_degree.c b/swad_degree.c index 76f68711..428f0a3d 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -2295,7 +2295,7 @@ void Deg_ShowAlertAndButtonToGoToDeg (void) } else /***** Alert *****/ - Ale_ShowDelayedAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } static void Deg_PutParamGoToDeg (void) diff --git a/swad_enrolment.c b/swad_enrolment.c index 4772f3c6..22610816 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -3490,7 +3490,7 @@ void Enr_RemUsrFromCrs1 (void) void Enr_RemUsrFromCrs2 (void) { - Ale_ShowDelayedAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } /*****************************************************************************/ diff --git a/swad_file_browser.c b/swad_file_browser.c index b71c5f37..d66bc37f 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -8869,7 +8869,7 @@ void Brw_RecFolderFileBrowser (void) } } else // Folder name not valid - Ale_ShowDelayedAlert (Ale_WARNING,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } else Lay_ShowErrorAndExit (Txt_You_can_not_create_folders_here); // It's difficult, but not impossible that a user sees this message @@ -8982,7 +8982,7 @@ void Brw_RenFolderFileBrowser (void) Gbl.FileBrowser.FilFolLnkName); } else // Folder name not valid - Ale_ShowDelayedAlert (Ale_WARNING,Gbl.DelayedAlert.Txt); + Ale_ShowDelayedAlert (); } else Lay_ShowErrorAndExit (Txt_You_can_not_rename_this_folder); diff --git a/swad_game.c b/swad_game.c index 0246e357..54c04a08 100644 --- a/swad_game.c +++ b/swad_game.c @@ -277,7 +277,7 @@ static void Gam_ListAllGames (void) Tbl_EndTable (); } else // No games created - Ale_ShowA_old (Ale_INFO,Txt_No_games); + Ale_ShowAlert (Ale_INFO,Txt_No_games); /***** Button to create a new game *****/ if (Gam_CheckIfICanCreateGame ()) @@ -1549,10 +1549,8 @@ void Gam_RemoveGame (void) Game.GamCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Game_X_removed, - Game.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Game_X_removed, + Game.Title); /***** Show games again *****/ Gam_ListAllGames (); @@ -1582,10 +1580,8 @@ void Gam_AskResetGame (void) Lay_ShowErrorAndExit ("You can not reset this game."); /***** Ask for confirmation of reset *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Do_you_really_want_to_reset_the_game_X, - Game.Title); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_Do_you_really_want_to_reset_the_game_X, + Game.Title); /***** Button of confirmation of reset *****/ Gbl.Games.CurrentGamCod = Game.GamCod; @@ -1641,10 +1637,8 @@ void Gam_ResetGame (void) Game.GamCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Game_X_reset, - Game.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Game_X_reset, + Game.Title); /***** Show games again *****/ Gam_ListAllGames (); @@ -1674,10 +1668,8 @@ void Gam_HideGame (void) Game.GamCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Game_X_is_now_hidden, - Game.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Game_X_is_now_hidden, + Game.Title); /***** Show games again *****/ Gam_ListAllGames (); @@ -1707,10 +1699,8 @@ void Gam_UnhideGame (void) Game.GamCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Game_X_is_now_visible, - Game.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Game_X_is_now_visible, + Game.Title); /***** Show games again *****/ Gam_ListAllGames (); @@ -2150,16 +2140,14 @@ void Gam_RecFormGame (void) if (Gam_CheckIfSimilarGameExists (&NewGame)) { NewGameIsCorrect = false; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Already_existed_a_game_with_the_title_X, - NewGame.Title); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_game_with_the_title_X, + NewGame.Title); } } else // If there is not a game title { NewGameIsCorrect = false; - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_title_of_the_game); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_title_of_the_game); } /***** Create a new game or update an existing one *****/ @@ -2214,10 +2202,8 @@ static void Gam_CreateGame (struct Game *Game,const char *Txt) Gam_CreateGrps (Game->GamCod); /***** Write success message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Created_new_game_X, - Game->Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_game_X, + Game->Title); } /*****************************************************************************/ @@ -2254,7 +2240,7 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt) Gam_CreateGrps (Game->GamCod); /***** Write success message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_game_has_been_modified); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_game_has_been_modified); } /*****************************************************************************/ @@ -2792,7 +2778,7 @@ static void Gam_ListGameQuestions (struct Game *Game) } } else // This game has no questions - Ale_ShowA_old (Ale_INFO,Txt_This_game_has_no_questions); + Ale_ShowAlert (Ale_INFO,Txt_This_game_has_no_questions); if (Game->Status.ICanEdit && // I can edit (!NumQsts || // This game has no questions @@ -3034,7 +3020,7 @@ void Gam_AddTstQuestionsToGame (void) /* Check number of questions */ if (Gam_CountNumQuestionsInList () == 0) // If no questions selected... { // ...write warning alert - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_questions); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_questions); // TODO: Show form again!!! } @@ -3307,7 +3293,7 @@ void Gam_RemoveQst (void) Game.GamCod,QstInd); /***** Write message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Question_removed); + Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); /***** Show current game *****/ Gam_ShowOneGame (Game.GamCod, @@ -3353,7 +3339,7 @@ void Gam_MoveUpQst (void) (unsigned) QstIndTop,(unsigned) QstIndBottom); /* Success alert */ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_question_has_been_moved_up); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_question_has_been_moved_up); } /***** Show current game *****/ @@ -3405,7 +3391,7 @@ void Gam_MoveDownQst (void) (unsigned) QstIndTop,(unsigned) QstIndBottom); /* Success alert */ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_question_has_been_moved_down); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_question_has_been_moved_down); } /***** Show current game *****/ @@ -3576,7 +3562,7 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers) " AND gam_questions.QstInd=%u" " AND gam_questions.QstCod=tst_questions.QstCod", Game.GamCod,QstInd)) - Ale_ShowA_old (Ale_WARNING,"Questions doesn't exist."); + Ale_ShowAlert (Ale_ERROR,"Question doesn't exist."); row = mysql_fetch_row (mysql_res); /***** Show question *****/ @@ -3687,12 +3673,12 @@ void Gam_ReceiveGameAnswers (void) /***** Check if I have no answered this game formerly *****/ if (Game.Status.IHaveAnswered) - Ale_ShowA_old (Ale_WARNING,Txt_You_already_played_this_game_before); + Ale_ShowAlert (Ale_WARNING,Txt_You_already_played_this_game_before); else { /***** Receive and store user's answers *****/ Gam_ReceiveAndStoreUserAnswersToAGame (Game.GamCod); - Ale_ShowA_old (Ale_INFO,Txt_Thanks_for_playing_the_game); + Ale_ShowAlert (Ale_INFO,Txt_Thanks_for_playing_the_game); } /***** Show current game *****/ diff --git a/swad_group.c b/swad_group.c index 845cdcaa..0915983a 100644 --- a/swad_group.c +++ b/swad_group.c @@ -238,7 +238,7 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons /***** Show optional alert *****/ if (MessageGroupTypes) if (MessageGroupTypes[0]) - Ale_ShowA_old (AlertTypeGroupTypes,MessageGroupTypes); + Ale_ShowAlert (AlertTypeGroupTypes,MessageGroupTypes); /***** Put form to edit group types *****/ Grp_EditGroupTypes (); @@ -255,7 +255,7 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const ch /***** Show optional alert *****/ if (MessageGroups) if (MessageGroups[0]) - Ale_ShowA_old (AlertTypeGroups,MessageGroups); + Ale_ShowAlert (AlertTypeGroups,MessageGroups); /***** Put form to edit groups *****/ if (Gbl.CurrentCrs.Grps.GrpTypes.Num) // If there are group types... @@ -292,12 +292,8 @@ static void Grp_EditGroupTypes (void) if (Gbl.CurrentCrs.Grps.GrpTypes.Num) // Group types found... Grp_ListGroupTypesForEdition (); else // No group types found in this course - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_are_no_types_of_group_in_the_course_X, - Gbl.CurrentCrs.Crs.ShrtName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_There_are_no_types_of_group_in_the_course_X, + Gbl.CurrentCrs.Crs.ShrtName); /***** End box *****/ Box_EndBox (); @@ -324,12 +320,8 @@ static void Grp_EditGroups (void) if (Gbl.CurrentCrs.Grps.GrpTypes.NumGrpsTotal) // If there are groups... Grp_ListGroupsForEdition (); else // There are group types, but there aren't groups - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_No_groups_have_been_created_in_the_course_X, - Gbl.CurrentCrs.Crs.ShrtName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X, + Gbl.CurrentCrs.Crs.ShrtName); /***** End box *****/ Box_EndBox (); @@ -1125,20 +1117,16 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr /* If the enrolment is single and the group to which the user belongs is different from the selected ==> remove user from the group to which he belongs */ Grp_RemoveUsrFromGroup (UsrDat->UsrCod,LstGrpsHeBelongs.GrpCods[NumGrpHeBelongs]); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_from_the_group_of_type_Y_to_which_it_belonged, - UsrDat->FullName,Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_from_the_group_of_type_Y_to_which_it_belonged, + UsrDat->FullName,Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); } if (!AlreadyRegisteredInGrp) // If the user does not belong to the selected group { Grp_AddUsrToGroup (UsrDat,LstGrps->GrpCods[NumGrpSel]); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_enroled_in_the_group_of_type_Y_Z, - UsrDat->FullName,Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, - Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_in_the_group_of_type_Y_Z, + UsrDat->FullName,Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, + Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpName); } break; // Once we know the type of a selected group, it's not necessary to check the rest of types @@ -1186,18 +1174,14 @@ unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *Lst /***** Write message to inform about how many groups the student has been removed from *****/ if (NumGrpsHeIsRemoved == 0) - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_not_been_removed_from_any_group, - UsrDat->FullName); + Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_not_been_removed_from_any_group, + UsrDat->FullName); else if (NumGrpsHeIsRemoved == 1) - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_from_one_group, - UsrDat->FullName); + Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_from_one_group, + UsrDat->FullName); else // NumGrpsHeIsRemoved > 1 - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_from_Y_groups, - UsrDat->FullName,NumGrpsHeIsRemoved); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_from_Y_groups, + UsrDat->FullName,NumGrpsHeIsRemoved); /***** Free the list of groups of this type to which the user belonged *****/ Grp_FreeListCodGrp (&LstGrpsHeBelongs); @@ -1866,10 +1850,8 @@ void Grp_ShowLstGrpsToChgMyGrps (void) } else // This course has no groups { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_No_groups_have_been_created_in_the_course_X, - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X, + Gbl.CurrentCrs.Crs.FullName); /***** Button to create group *****/ if (ICanEdit) @@ -1920,21 +1902,13 @@ static void Grp_ShowWarningToStdsToChangeGrps (void) if (Grp_GetIfGrpIsAvailable (GrpTyp->GrpTypCod)) // If there is any group of this type available { if (GrpTyp->MandatoryEnrolment) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - GrpTyp->MultipleEnrolment ? Txt_You_have_to_register_compulsorily_at_least_in_one_group_of_type_X : - Txt_You_have_to_register_compulsorily_in_one_group_of_type_X, - GrpTyp->GrpTypName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,GrpTyp->MultipleEnrolment ? Txt_You_have_to_register_compulsorily_at_least_in_one_group_of_type_X : + Txt_You_have_to_register_compulsorily_in_one_group_of_type_X, + GrpTyp->GrpTypName); else - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - GrpTyp->MultipleEnrolment ? Txt_You_can_register_voluntarily_in_one_or_more_groups_of_type_X : - Txt_You_can_register_voluntarily_in_one_group_of_type_X, - GrpTyp->GrpTypName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,GrpTyp->MultipleEnrolment ? Txt_You_can_register_voluntarily_in_one_or_more_groups_of_type_X : + Txt_You_can_register_voluntarily_in_one_group_of_type_X, + GrpTyp->GrpTypName); } } } @@ -4644,7 +4618,7 @@ void Grp_ChangeOpenTimeGrpTyp (void) Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); /***** Write message to show the change made *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); /***** Show the form again *****/ Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.Alert.Txt, diff --git a/swad_help.c b/swad_help.c index e3f4af01..44e2a132 100644 --- a/swad_help.c +++ b/swad_help.c @@ -121,14 +121,10 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) /***** Alert message *****/ if (Gbl.Usrs.Me.Logged && !Gbl.Usrs.Me.MyCrss.Num) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s
%s
%s", - Txt_You_are_not_enroled_in_any_course[Gbl.Usrs.Me.UsrDat.Sex], - Txt_You_can_search_for_courses_select_them_and_request_your_enrolment_in_them, - Txt_If_you_can_not_find_your_institution_your_centre_your_degree_or_your_courses_you_can_create_them); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,"%s
%s
%s", + Txt_You_are_not_enroled_in_any_course[Gbl.Usrs.Me.UsrDat.Sex], + Txt_You_can_search_for_courses_select_them_and_request_your_enrolment_in_them, + Txt_If_you_can_not_find_your_institution_your_centre_your_degree_or_your_courses_you_can_create_them); /***** Start box and table *****/ Box_StartBoxTable (NULL,Txt_What_would_you_like_to_do,NULL, diff --git a/swad_holiday.c b/swad_holiday.c index b2caa15b..301bbeac 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -176,7 +176,7 @@ void Hld_SeeHolidays (void) Tbl_EndTable (); } else // No holidays created in the current institution - Ale_ShowA_old (Ale_INFO,Txt_No_holidays); + Ale_ShowAlert (Ale_INFO,Txt_No_holidays); /***** Button to create centre *****/ if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) // Institution admin or system admin diff --git a/swad_image.c b/swad_image.c index 60bf6101..d0e213ef 100644 --- a/swad_image.c +++ b/swad_image.c @@ -545,7 +545,7 @@ void Img_MoveImageToDefinitiveDirectory (struct Image *Image) /***** Move file *****/ if (rename (FileNameImgTmp,FileNameImg)) // Fail - Ale_ShowA_old (Ale_ERROR,"Can not move file."); + Ale_ShowAlert (Ale_ERROR,"Can not move file."); else // Success Image->Status = Img_FILE_MOVED; } @@ -628,7 +628,7 @@ void Img_ShowImage (struct Image *Image, fprintf (Gbl.F.Out,""); } else - Ale_ShowA_old (Ale_WARNING,Txt_Image_not_found); + Ale_ShowAlert (Ale_WARNING,Txt_Image_not_found); } /*****************************************************************************/ diff --git a/swad_info.c b/swad_info.c index 39d45063..4612b7fe 100644 --- a/swad_info.c +++ b/swad_info.c @@ -450,7 +450,7 @@ void Inf_ShowInfo (void) ICanEdit ? Inf_PutIconToEditInfo : NULL, Help[Gbl.CurrentCrs.Info.Type],Box_NOT_CLOSABLE); - Ale_ShowA_old (Ale_INFO,Txt_No_information); + Ale_ShowAlert (Ale_INFO,Txt_No_information); if (ICanEdit) Inf_PutButtonToEditInfo (); Box_EndBox (); @@ -597,7 +597,7 @@ void Inf_WriteMsgYouMustReadInfo (void) NULL,Box_NOT_CLOSABLE); /***** Write message *****/ - Ale_ShowA_old (Ale_WARNING,Txt_You_should_read_the_following_information); + Ale_ShowAlert (Ale_WARNING,Txt_You_should_read_the_following_information); /***** Write every information I must read *****/ fprintf (Gbl.F.Out,"
" @@ -642,7 +642,7 @@ void Inf_ChangeForceReadInfo (void) Inf_SetForceReadIntoDB (MustBeRead); /***** Write message of success *****/ - Ale_ShowA_old (Ale_SUCCESS, + Ale_ShowAlert (Ale_SUCCESS, MustBeRead ? Txt_Students_now_are_required_to_read_this_information : Txt_Students_are_no_longer_obliged_to_read_this_information); @@ -667,7 +667,7 @@ void Inf_ChangeIHaveReadInfo (void) Inf_SetIHaveReadIntoDB (IHaveRead); /***** Write message of success *****/ - Ale_ShowA_old (Ale_SUCCESS, + Ale_ShowAlert (Ale_SUCCESS, IHaveRead ? Txt_You_have_confirmed_that_you_have_read_this_information : Txt_You_have_eliminated_the_confirmation_that_you_have_read_this_information); @@ -2243,14 +2243,12 @@ void Inf_ReceiveURLInfo (void) fclose (FileURL); /***** Write message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_URL_X_has_been_updated, - Gbl.CurrentCrs.Info.URL); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_URL_X_has_been_updated, + Gbl.CurrentCrs.Info.URL); URLIsOK = true; } else - Ale_ShowA_old (Ale_ERROR,"Error when saving URL to file."); + Ale_ShowAlert (Ale_ERROR,"Error when saving URL to file."); if (URLIsOK) { @@ -2312,12 +2310,8 @@ void Inf_ReceivePagInfo (void) if (strcmp (MIMEType,"application/octet")) WrongType = true; if (WrongType) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_file_type_is_X_and_should_be_HTML_or_ZIP, - MIMEType); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_The_file_type_is_X_and_should_be_HTML_or_ZIP, + MIMEType); else { /***** Build path of directory containing web page *****/ @@ -2334,11 +2328,11 @@ void Inf_ReceivePagInfo (void) PathRelDirHTML); if (Fil_EndReceptionOfFile (PathRelFileHTML,Param)) { - Ale_ShowA_old (Ale_SUCCESS,Txt_The_HTML_file_has_been_received_successfully); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_HTML_file_has_been_received_successfully); FileIsOK = true; } else - Ale_ShowA_old (Ale_WARNING,"Error uploading file."); + Ale_ShowAlert (Ale_ERROR,"Error uploading file."); } else if (Str_FileIs (SourceFileName,"zip")) // .zip file { @@ -2351,7 +2345,7 @@ void Inf_ReceivePagInfo (void) if (Fil_EndReceptionOfFile (PathRelFileZIP,Param)) { - Ale_ShowA_old (Ale_SUCCESS,Txt_The_ZIP_file_has_been_received_successfully); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_received_successfully); /* Uncompress ZIP */ snprintf (StrUnzip,sizeof (StrUnzip), @@ -2365,8 +2359,8 @@ void Inf_ReceivePagInfo (void) PathRelDirHTML); if (Fil_CheckIfPathExists (PathRelFileHTML)) { - Ale_ShowA_old (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully); - Ale_ShowA_old (Ale_SUCCESS,Txt_Found_an_index_html_file); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully); + Ale_ShowAlert (Ale_SUCCESS,Txt_Found_an_index_html_file); FileIsOK = true; } else @@ -2376,22 +2370,22 @@ void Inf_ReceivePagInfo (void) PathRelDirHTML); if (Fil_CheckIfPathExists (PathRelFileHTML)) { - Ale_ShowA_old (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully); - Ale_ShowA_old (Ale_SUCCESS,Txt_Found_an_index_htm_file); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully); + Ale_ShowAlert (Ale_SUCCESS,Txt_Found_an_index_htm_file); FileIsOK = true; } else - Ale_ShowA_old (Ale_WARNING,Txt_No_file_index_html_index_htm_found_within_the_ZIP_file); + Ale_ShowAlert (Ale_WARNING,Txt_No_file_index_html_index_htm_found_within_the_ZIP_file); } } else Lay_ShowErrorAndExit ("Can not unzip file."); } else - Ale_ShowA_old (Ale_WARNING,"Error uploading file."); + Ale_ShowAlert (Ale_ERROR,"Error uploading file."); } else - Ale_ShowA_old (Ale_WARNING,Txt_The_file_type_should_be_HTML_or_ZIP); + Ale_ShowAlert (Ale_WARNING,Txt_The_file_type_should_be_HTML_or_ZIP); } if (FileIsOK) @@ -2420,7 +2414,7 @@ void Inf_EditorCourseInfo (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); @@ -2434,7 +2428,7 @@ void Inf_EditorTeachingGuide (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); @@ -2448,7 +2442,7 @@ void Inf_EditorBibliography (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); @@ -2462,7 +2456,7 @@ void Inf_EditorFAQ (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); @@ -2476,7 +2470,7 @@ void Inf_EditorLinks (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); @@ -2490,7 +2484,7 @@ void Inf_EditorAssessment (void) { extern const char *Txt_The_integrated_editor_is_not_yet_available; - Ale_ShowA_old (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); + Ale_ShowAlert (Ale_WARNING,Txt_The_integrated_editor_is_not_yet_available); /***** Show again the form to select and send course info *****/ Inf_FormsToSelSendInfo (); diff --git a/swad_institution.c b/swad_institution.c index e3d17f8a..18c92553 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -215,7 +215,7 @@ void Ins_SeeInsWithPendingCtrs (void) Box_EndBoxTable (); } else - Ale_ShowA_old (Ale_INFO,Txt_There_are_no_institutions_with_requests_for_centres_to_be_confirmed); + Ale_ShowAlert (Ale_INFO,Txt_There_are_no_institutions_with_requests_for_centres_to_be_confirmed); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -708,7 +708,7 @@ static void Ins_ListInstitutions (void) Tbl_EndTable (); } else // No insrtitutions created in the current country - Ale_ShowA_old (Ale_INFO,Txt_No_institutions); + Ale_ShowAlert (Ale_INFO,Txt_No_institutions); /***** Button to create institution *****/ if (Ins_CheckIfICanCreateInstitutions ()) @@ -1731,7 +1731,7 @@ void Ins_RemoveInstitution (void) else if (Ins.NumCtrs || Ins.NumUsrsWhoClaimToBelongToIns || Ins.NumUsrs) // Institution has centres or users ==> don't remove - Ale_ShowA_old (Ale_WARNING,Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution); + Ale_ShowAlert (Ale_WARNING,Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution); else // Institution has no users ==> remove it { /***** Remove all the threads and posts in forums of the institution *****/ diff --git a/swad_mark.c b/swad_mark.c index 8a8ea0fd..ee4bf2bb 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -466,8 +466,8 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat, /***** Open HTML file with the table of marks *****/ if (!(FileAllMarks = fopen (PathFileAllMarks,"rb"))) { // Can't open the file with the table of marks - Gbl.Alert.Type = Ale_WARNING; - Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.", // TODO: Need translation! + Gbl.Alert.Type = Ale_ERROR; + Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.", Ale_MAX_BYTES_ALERT); return false; } @@ -881,8 +881,8 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], } else { - Gbl.Alert.Type = Ale_WARNING; - Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.", // TODO: Need translation! + Gbl.Alert.Type = Ale_ERROR; + Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.", Ale_MAX_BYTES_ALERT); if (asprintf (ContentStr,"", Gbl.Alert.Txt) < 0) @@ -892,8 +892,8 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], } else { - Gbl.Alert.Type = Ale_WARNING; - Str_Copy (Gbl.Alert.Txt,"User's IDs not found!", // TODO: Need translation! + Gbl.Alert.Type = Ale_ERROR; + Str_Copy (Gbl.Alert.Txt,"User's IDs not found!", Ale_MAX_BYTES_ALERT); if (asprintf (ContentStr,"", Gbl.Alert.Txt) < 0) diff --git a/swad_password.c b/swad_password.c index 6ac88bb9..848e8aec 100644 --- a/swad_password.c +++ b/swad_password.c @@ -692,7 +692,7 @@ void Pwd_ShowFormChgMyPwd (void) /***** Show possible alert *****/ if (Gbl.Alert.Section == Pwd_PASSWORD_SECTION_ID) - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowA_old (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); /***** Help message *****/ if (!IHaveAPasswordInDB) // If I don't have a password in database... diff --git a/swad_string.c b/swad_string.c index bac44937..58fc3528 100644 --- a/swad_string.c +++ b/swad_string.c @@ -2797,16 +2797,22 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName) if (NumAlfanum) FileNameIsOK = true; else + { + Gbl.DelayedAlert.Type = Ale_WARNING; snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_X_invalid_name_NO_HTML : Txt_UPLOAD_FILE_X_invalid_name, FileName); + } } else // FileName is empty + { + Gbl.DelayedAlert.Type = Ale_WARNING; Str_Copy (Gbl.DelayedAlert.Txt, Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML : Txt_UPLOAD_FILE_Invalid_name, Ale_MAX_BYTES_ALERT); + } return FileNameIsOK; }