From 001f4938dcd5235c4a1dd27a9417d4fe2be53e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 16 Feb 2019 17:20:05 +0100 Subject: [PATCH] Version 18.46.7 --- swad_alert.c | 2 +- swad_changelog.h | 5 ++- swad_institution.c | 50 +++++++++++------------------ swad_layout.c | 2 +- swad_link.c | 72 +++++++++++++----------------------------- swad_logo.c | 16 +++------- swad_mail.c | 79 +++++++++++++++++----------------------------- swad_mark.c | 15 ++++----- 8 files changed, 88 insertions(+), 153 deletions(-) diff --git a/swad_alert.c b/swad_alert.c index cce1622fc..0fc3fb3ad 100644 --- a/swad_alert.c +++ b/swad_alert.c @@ -124,7 +124,7 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...) // vasprintf will return -1 Lay_NotEnoughMemoryExit (); - Ale_ShowAlert (AlertType,Txt); + Ale_ShowFixAlert (AlertType,Txt); free ((void *) Txt); } diff --git a/swad_changelog.h b/swad_changelog.h index 517cad7b4..dea22bb07 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -383,6 +383,8 @@ OPTIMIZE TABLE debug; // TODO: Revisar todos los Ale_ShowAlertAndButton +// TODO: Pasar a una función Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ @@ -402,10 +404,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.46.6 (2019-02-16)" +#define Log_PLATFORM_VERSION "SWAD 18.46.7 (2019-02-16)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + 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) Version 18.46.4: Feb 16, 2019 Refactoring code related to alerts. (238061 lines) diff --git a/swad_institution.c b/swad_institution.c index 18c92553e..5d439b226 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -1761,10 +1761,8 @@ void Ins_RemoveInstitution (void) Ins_FlushCacheFullNameAndCtyOfInstitution (); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Institution_X_removed, - Ins.FullName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Institution_X_removed, + Ins.FullName); } /***** Show the form again *****/ @@ -2025,14 +2023,14 @@ void Ins_ChangeInsWWW (void) /***** Write message to show the change made and put button to go to institution changed *****/ - Gbl.Alert.Type = Ale_SUCCESS; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), + Gbl.DelayedAlert.Type = Ale_SUCCESS; + snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_new_web_address_is_X, NewWWW); Ins_ShowAlertAndButtonToGoToIns (); } else - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Ins_EditInstitutions (); @@ -2057,13 +2055,11 @@ void Ins_ChangeInsWWWInConfig (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_ShowAlert (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_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Ins_ShowConfiguration (); @@ -2117,8 +2113,8 @@ void Ins_ChangeInsStatus (void) /***** Write message to show the change made and put button to go to institution changed *****/ - Gbl.Alert.Type = Ale_SUCCESS; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), + Gbl.DelayedAlert.Type = Ale_SUCCESS; + snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_status_of_the_institution_X_has_changed, Gbl.Inss.EditingIns.ShrtName); Ins_ShowAlertAndButtonToGoToIns (); @@ -2165,7 +2161,7 @@ static void Ins_ShowAlertAndButtonToGoToIns (void) } else /***** Alert *****/ - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowDelayedAlert (); } static void Ins_PutParamGoToIns (void) @@ -2399,27 +2395,19 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status) { /***** If name of institution was in database... *****/ if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.Inss.EditingIns.ShrtName,-1L,Gbl.CurrentCty.Cty.CtyCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_institution_X_already_exists, - Gbl.Inss.EditingIns.ShrtName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_institution_X_already_exists, + Gbl.Inss.EditingIns.ShrtName); else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.Inss.EditingIns.FullName,-1L,Gbl.CurrentCty.Cty.CtyCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_institution_X_already_exists, - Gbl.Inss.EditingIns.FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_institution_X_already_exists, + Gbl.Inss.EditingIns.FullName); else // Add new institution to database Ins_CreateInstitution (Status); } else // If there is not a web - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_institution); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_institution); } else // If there is not a institution name - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_institution); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_institution); /***** Show the form again *****/ Ins_EditInstitutions (); @@ -2450,8 +2438,8 @@ static void Ins_CreateInstitution (unsigned Status) /***** Write message to show the change made and put button to go to institution created *****/ - Gbl.Alert.Type = Ale_SUCCESS; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), + Gbl.DelayedAlert.Type = Ale_SUCCESS; + snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_institution_X, Gbl.Inss.EditingIns.FullName); Ins_ShowAlertAndButtonToGoToIns (); diff --git a/swad_layout.c b/swad_layout.c index e22abfe61..81549a970 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1269,7 +1269,7 @@ void Lay_ShowErrorAndExit (const char *Txt) /***** Write possible error message *****/ if (Txt) - Ale_ShowA_old (Ale_ERROR,Txt); + Ale_ShowAlert (Ale_ERROR,Txt); /***** Finish the page, except and *****/ Lay_WriteEndOfPage (); diff --git a/swad_link.c b/swad_link.c index 5b14a92eb..c2d6e5a61 100644 --- a/swad_link.c +++ b/swad_link.c @@ -104,7 +104,7 @@ void Lnk_SeeLinks (void) if (Gbl.Links.Num) // There are links Lnk_WriteListOfLinks (); else // No links created - Ale_ShowA_old (Ale_INFO,Txt_No_links); + Ale_ShowAlert (Ale_INFO,Txt_No_links); /***** Button to create link *****/ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) @@ -507,10 +507,8 @@ void Lnk_RemoveLink (void) Lnk.LnkCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Link_X_removed, - Lnk.ShrtName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Link_X_removed, + Lnk.ShrtName); /***** Show the form again *****/ Lnk_EditLinks (); @@ -581,12 +579,8 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName) /***** Check if new name is empty *****/ if (!NewLnkName[0]) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_can_not_leave_the_name_of_the_link_X_empty, - CurrentLnkName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_name_of_the_link_X_empty, + CurrentLnkName); else { /***** Check if old and new names are the same @@ -595,31 +589,21 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName) { /***** If link was in database... *****/ if (Lnk_CheckIfLinkNameExists (ParamName,NewLnkName,Lnk->LnkCod)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_link_X_already_exists, - NewLnkName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_link_X_already_exists, + NewLnkName); else { /* Update the table changing old name by new name */ Lnk_UpdateLnkNameDB (Lnk->LnkCod,FieldName,NewLnkName); /* Write message to show the change made */ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_link_X_has_been_renamed_as_Y, - CurrentLnkName,NewLnkName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_link_X_has_been_renamed_as_Y, + CurrentLnkName,NewLnkName); } } else // The same name - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_name_of_the_link_X_has_not_changed, - CurrentLnkName); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_The_name_of_the_link_X_has_not_changed, + CurrentLnkName); } /***** Show the form again *****/ @@ -684,13 +668,11 @@ void Lnk_ChangeLinkWWW (void) NewWWW,Lnk->LnkCod); /***** 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_ShowAlert (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_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Str_Copy (Lnk->WWW,NewWWW, @@ -820,26 +802,18 @@ void Lnk_RecFormNewLink (void) { /***** If name of link was in database... *****/ if (Lnk_CheckIfLinkNameExists ("ShortName",Lnk->ShrtName,-1L)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_link_X_already_exists, - Lnk->ShrtName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_link_X_already_exists, + Lnk->ShrtName); else if (Lnk_CheckIfLinkNameExists ("FullName",Lnk->FullName,-1L)) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_link_X_already_exists, - Lnk->FullName); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_link_X_already_exists, + Lnk->FullName); else if (!Lnk->WWW[0]) - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_URL_of_the_new_link); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_URL_of_the_new_link); else // Add new link to database Lnk_CreateLink (Lnk); } else // If there is not a link name - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_link); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_link); /***** Show the form again *****/ Lnk_EditLinks (); @@ -862,8 +836,6 @@ static void Lnk_CreateLink (struct Link *Lnk) Lnk->ShrtName,Lnk->FullName,Lnk->WWW); /***** Write success message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Created_new_link_X, - Lnk->ShrtName); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_link_X, + Lnk->ShrtName); } diff --git a/swad_logo.c b/swad_logo.c index 2c6ab4c36..f13bd2088 100644 --- a/swad_logo.c +++ b/swad_logo.c @@ -292,10 +292,8 @@ void Log_RequestLogo (Sco_Scope_t Scope) NULL,Box_NOT_CLOSABLE); /***** Write help message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y, - 64,64); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_INFO,Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y, + 64,64); /***** Upload logo *****/ fprintf (Gbl.F.Out,"