diff --git a/swad_changelog.h b/swad_changelog.h index dea22bb07..160d2b7af 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -404,10 +404,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.46.7 (2019-02-16)" +#define Log_PLATFORM_VERSION "SWAD 18.46.8 (2019-02-16)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.46.8: Feb 16, 2019 Refactoring code related to alerts. (237863 lines) Version 18.46.7: Feb 16, 2019 Refactoring code related to alerts. (237953 lines) 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) diff --git a/swad_message.c b/swad_message.c index 5e6df6b3e..f2702650c 100644 --- a/swad_message.c +++ b/swad_message.c @@ -702,14 +702,14 @@ void Msg_RecMsgFromUsr (void) NumRecipients > Cfg_MAX_RECIPIENTS) { /* Write warning message */ - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_send_a_message_to_so_many_recipients_); + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_send_a_message_to_so_many_recipients_); Error = true; } } else // No recipients selected { /* Write warning message */ - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_recipients); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_recipients); Error = true; } @@ -752,13 +752,9 @@ void Msg_RecMsgFromUsr (void) RecipientHasBannedMe = Msg_CheckIfUsrIsBanned (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDstData.UsrCod); if (RecipientHasBannedMe) - { /***** Show an alert indicating that the message has not been sent successfully *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_message_not_sent_to_X, - UsrDstData.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_message_not_sent_to_X, + UsrDstData.FullName); else { /***** Create message *****/ @@ -792,11 +788,9 @@ void Msg_RecMsgFromUsr (void) 0)); /***** Show an alert indicating that the message has been sent successfully *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - NotifyByEmail ? Txt_message_sent_to_X_notified_by_email : - Txt_message_sent_to_X_not_notified_by_email, - UsrDstData.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,NotifyByEmail ? Txt_message_sent_to_X_notified_by_email : + Txt_message_sent_to_X_not_notified_by_email, + UsrDstData.FullName); /***** Increment number of recipients *****/ if (NotifyByEmail) @@ -806,7 +800,7 @@ void Msg_RecMsgFromUsr (void) } else { - Ale_ShowA_old (Ale_ERROR,Txt_Error_getting_data_from_a_recipient); + Ale_ShowAlert (Ale_ERROR,Txt_Error_getting_data_from_a_recipient); NumErrors++; } } @@ -830,26 +824,18 @@ void Msg_RecMsgFromUsr (void) if (NumRecipients) { if (NumRecipients == 1) - Ale_ShowA_old (Ale_SUCCESS,Txt_The_message_has_been_sent_to_1_recipient); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_message_has_been_sent_to_1_recipient); else - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_message_has_been_sent_to_X_recipients, - (unsigned) NumRecipients); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_SUCCESS,Txt_The_message_has_been_sent_to_X_recipients, + (unsigned) NumRecipients); } else - Ale_ShowA_old (Ale_WARNING,Txt_The_message_has_not_been_sent_to_any_recipient); + Ale_ShowAlert (Ale_WARNING,Txt_The_message_has_not_been_sent_to_any_recipient); /***** Show alert about errors on sending message *****/ if (NumErrors > 1) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_have_been_X_errors_in_sending_the_message, - (unsigned) NumErrors); - Ale_ShowA_old (Ale_ERROR,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_ERROR,Txt_There_have_been_X_errors_in_sending_the_message, + (unsigned) NumErrors); } /*****************************************************************************/ @@ -1010,14 +996,10 @@ static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs) extern const char *Txt_X_messages_have_been_deleted; if (NumMsgs == 1) - Ale_ShowA_old (Ale_SUCCESS,Txt_One_message_has_been_deleted); + Ale_ShowAlert (Ale_SUCCESS,Txt_One_message_has_been_deleted); else - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_X_messages_have_been_deleted, - NumMsgs); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_SUCCESS,Txt_X_messages_have_been_deleted, + NumMsgs); } /*****************************************************************************/ @@ -1115,7 +1097,7 @@ void Msg_DelSntMsg (void) /***** Delete the message *****/ /* Delete the sent message */ Msg_MoveSentMsgToDeleted (MsgCod); - Ale_ShowA_old (Ale_SUCCESS,Txt_Message_deleted); + Ale_ShowAlert (Ale_SUCCESS,Txt_Message_deleted); /* Show the remaining messages */ Msg_ShowSntMsgs (); @@ -1137,7 +1119,7 @@ void Msg_DelRecMsg (void) /***** Delete the message *****/ /* Delete the received message */ Msg_MoveReceivedMsgToDeleted (MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); - Ale_ShowA_old (Ale_SUCCESS,Txt_Message_deleted); + Ale_ShowAlert (Ale_SUCCESS,Txt_Message_deleted); /* Show the remaining messages */ Msg_ShowRecMsgs (); @@ -3718,10 +3700,8 @@ void Msg_BanSenderWhenShowingMsgs (void) Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod); /***** Show alert with the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_From_this_time_you_will_not_receive_messages_from_X, - Gbl.Usrs.Other.UsrDat.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_From_this_time_you_will_not_receive_messages_from_X, + Gbl.Usrs.Other.UsrDat.FullName); /**** Show received messages again */ Msg_ShowRecMsgs (); @@ -3775,10 +3755,8 @@ static void Msg_UnbanSender (void) Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod); /***** Show alert with the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_From_this_time_you_can_receive_messages_from_X, - Gbl.Usrs.Other.UsrDat.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_From_this_time_you_can_receive_messages_from_X, + Gbl.Usrs.Other.UsrDat.FullName); } /*****************************************************************************/ @@ -3836,7 +3814,7 @@ void Msg_ListBannedUsrs (void) Gbl.Usrs.Me.UsrDat.UsrCod); if (NumUsrs == 0) // If not result ==> sent message is deleted - Ale_ShowA_old (Ale_INFO,Txt_You_have_not_banned_any_sender); + Ale_ShowAlert (Ale_INFO,Txt_You_have_not_banned_any_sender); else { /***** Initialize structure with user's data *****/ diff --git a/swad_nickname.c b/swad_nickname.c index 44222f55f..251802572 100644 --- a/swad_nickname.c +++ b/swad_nickname.c @@ -254,12 +254,11 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its /***** Show possible alert *****/ if (Gbl.Alert.Section == (const char *) Nck_NICKNAME_SECTION_ID) - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowDelayedAlert (); /***** Help message *****/ if (IMustFillNickname) - Ale_ShowA_old (Ale_WARNING, - Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); + Ale_ShowAlert (Ale_WARNING,Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); /***** Start table *****/ Tbl_StartTableWide (2); @@ -488,10 +487,10 @@ void Nck_RemoveOtherUsrNick (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_); } /*****************************************************************************/ @@ -540,10 +539,10 @@ void Nck_UpdateOtherUsrNick (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_notice.c b/swad_notice.c index 88114220e..bc67a125e 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -98,10 +98,8 @@ void Not_ShowFormNotice (void) extern const char *Txt_Create_notice; /***** Help message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_notice_will_appear_as_a_yellow_note_, - Gbl.CurrentCrs.Crs.FullName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_INFO,Txt_The_notice_will_appear_as_a_yellow_note_, + Gbl.CurrentCrs.Crs.FullName); /***** Start form *****/ Frm_StartForm (ActRcvNot); @@ -148,7 +146,7 @@ void Not_ReceiveNotice (void) RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); /***** Write message of success *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Notice_created); + Ale_ShowAlert (Ale_SUCCESS,Txt_Notice_created); /***** Notify by email about the new notice *****/ if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_NOTICE,NotCod))) @@ -198,7 +196,7 @@ void Not_ListNoticesAfterRemoval (void) extern const char *Txt_Notice_removed; /***** Message of success *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Notice_removed); + Ale_ShowAlert (Ale_SUCCESS,Txt_Notice_removed); /***** List remaining notices *****/ Not_ListFullNotices (); @@ -404,7 +402,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing) Not_PutIconsListNotices, Hlp_MESSAGES_Notices,Box_NOT_CLOSABLE); if (!NumNotices) - Ale_ShowA_old (Ale_INFO,Txt_No_notices); + Ale_ShowAlert (Ale_INFO,Txt_No_notices); } /***** Show the notices *****/ diff --git a/swad_notification.c b/swad_notification.c index eab408c73..40ea6318c 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -627,7 +627,7 @@ void Ntf_ShowMyNotifications (void) Usr_UsrDataDestructor (&UsrDat); } else - Ale_ShowA_old (Ale_INFO,AllNotifications ? Txt_You_have_no_notifications : + Ale_ShowAlert (Ale_INFO,AllNotifications ? Txt_You_have_no_notifications : Txt_You_have_no_unread_notifications); /***** End box *****/ @@ -2040,7 +2040,7 @@ void Ntf_ChangeNotifyEvents (void) Gbl.Usrs.Me.UsrDat.UsrCod); /***** Show message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed); + Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed); } /*****************************************************************************/ diff --git a/swad_password.c b/swad_password.c index 848e8aec8..ca589fafd 100644 --- a/swad_password.c +++ b/swad_password.c @@ -201,10 +201,10 @@ void Pwd_UpdateOtherUsrPwd (void) /***** Check and update password *****/ Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Other.UsrDat); 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_); } /*****************************************************************************/ @@ -291,7 +291,7 @@ void Pwd_ShowFormSendNewPwd (void) Hlp_PROFILE_Password,Box_NOT_CLOSABLE); /***** Help text *****/ - Ale_ShowA_old (Ale_INFO,Txt_If_you_have_forgotten_your_password_); + Ale_ShowAlert (Ale_INFO,Txt_If_you_have_forgotten_your_password_); /***** User's ID/nickname *****/ fprintf (Gbl.F.Out,"