From afcae28b00b7320a2a7c0619c6bfcf81792af648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 16 Feb 2019 19:29:27 +0100 Subject: [PATCH] Version 18.46.10 --- swad_alert.c | 9 +--- swad_alert.h | 1 - swad_changelog.h | 27 +++++----- swad_survey.c | 68 ++++++++++-------------- swad_test.c | 128 +++++++++++++++++++-------------------------- swad_test_import.c | 14 ++--- swad_timetable.c | 4 +- swad_user.c | 90 ++++++++++--------------------- swad_zip.c | 4 +- 9 files changed, 132 insertions(+), 213 deletions(-) diff --git a/swad_alert.c b/swad_alert.c index 0fc3fb3a..0eb44a68 100644 --- a/swad_alert.c +++ b/swad_alert.c @@ -92,7 +92,7 @@ void Ale_ShowPendingAlert (void) /***** Anything to show? *****/ if (Gbl.Alert.Type != Ale_NONE) /***** Show alert *****/ - Ale_ShowA_old (Gbl.Alert.Type,Gbl.Alert.Txt); + Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt); Ale_ResetAlert (); } @@ -137,13 +137,6 @@ static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt) ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); } -void Ale_ShowA_old (Ale_AlertType_t AlertType,const char *Txt) - { - if (AlertType != Ale_NONE) - Ale_ShowAlertAndButton (AlertType,Txt, - ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); - } - void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt, Act_Action_t NextAction,const char *Anchor,const char *OnSubmit, void (*FuncParams) (), diff --git a/swad_alert.h b/swad_alert.h index c3a91f89..96c75b1e 100644 --- a/swad_alert.h +++ b/swad_alert.h @@ -63,7 +63,6 @@ void Ale_ResetAlert (void); void Ale_ShowPendingAlert (void); void Ale_ShowDelayedAlert (void); void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...); -void Ale_ShowA_old (Ale_AlertType_t AlertType,const char *Txt); void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt, Act_Action_t NextAction,const char *Anchor,const char *OnSubmit, void (*FuncParams) (), diff --git a/swad_changelog.h b/swad_changelog.h index 9538ec7e..f5f12583 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -405,22 +405,23 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.46.9 (2019-02-16)" +#define Log_PLATFORM_VERSION "SWAD 18.46.10 (2019-02-16)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* - Version 18.46.9: Feb 16, 2019 Refactoring code related to alerts. (237809 lines) - 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) - 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) + Version 18.46.10: Feb 16, 2019 Code refactoring related to alerts. (237729 lines) + Version 18.46.9: Feb 16, 2019 Code refactoring related to alerts. (237809 lines) + Version 18.46.8: Feb 16, 2019 Code refactoring related to alerts. (237863 lines) + Version 18.46.7: Feb 16, 2019 Code refactoring related to alerts. (237953 lines) + Version 18.46.6: Feb 16, 2019 Code refactoring related to alerts. (238019 lines) + Version 18.46.5: Feb 16, 2019 Code refactoring related to alerts. (238062 lines) + Version 18.46.4: Feb 16, 2019 Code refactoring related to alerts. (238061 lines) + Version 18.46.3: Feb 16, 2019 Code refactoring related to alerts. (238243 lines) + Version 18.46.2: Feb 16, 2019 Code refactoring related to alerts. (238298 lines) + Version 18.46.1: Feb 15, 2019 Code refactoring related to alerts. (238355 lines) Version 18.46: Feb 15, 2019 Removed unused code related to tabs. Fixed bug in actions related to login. - Refactoring code related to alerts. (238468 lines) + Code refactoring related to alerts. (238468 lines) 2 changes necessary in database: UPDATE actions SET Obsolete='Y' WHERE ActCod='34'; UPDATE actions SET Obsolete='Y' WHERE ActCod='844'; @@ -5261,8 +5262,8 @@ ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart', Version 14.113.3: Apr 15, 2015 New welcome message after creating an account. (184536 lines) Version 14.113.2: Apr 14, 2015 Fixed bug when compressing users' works. (184486 lines) Version 14.113.1: Apr 14, 2015 Fixed bug when compressing users' works, reported by José Martínez Aroza. (184484 lines) - Version 14.113: Apr 12, 2015 Refactoring code related to frames. (184462 lines) - Version 14.112.1: Apr 12, 2015 Refactoring code related to frames with ending buttons. (184583 lines) + Version 14.113: Apr 12, 2015 Code refactoring related to frames. (184462 lines) + Version 14.112.1: Apr 12, 2015 Code refactoring related to frames with ending buttons. (184583 lines) Version 14.112: Apr 12, 2015 Optimization in frames with ending buttons. Changes in form to upload logo. Changes in form to photo of centre. diff --git a/swad_survey.c b/swad_survey.c index 2176441b..b1296aac 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -279,7 +279,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) Tbl_EndTable (); } else // No surveys created - Ale_ShowA_old (Ale_INFO,Txt_No_surveys); + Ale_ShowAlert (Ale_INFO,Txt_No_surveys); /***** Button to create a new survey *****/ if (Svy_CheckIfICanCreateSvy ()) @@ -1579,10 +1579,8 @@ void Svy_RemoveSurvey (void) Ntf_MarkNotifAsRemoved (Ntf_EVENT_SURVEY,Svy.SvyCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Survey_X_removed, - Svy.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Survey_X_removed, + Svy.Title); /***** Show surveys again *****/ Svy_ListAllSurveys (&SvyQst); @@ -1616,10 +1614,8 @@ void Svy_AskResetSurvey (void) Lay_ShowErrorAndExit ("You can not reset this survey."); /***** Ask for confirmation of reset *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Do_you_really_want_to_reset_the_survey_X, - Svy.Title); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_Do_you_really_want_to_reset_the_survey_X, + Svy.Title); /***** Button of confirmation of reset *****/ Gbl.Svys.SvyCodToEdit = Svy.SvyCod; @@ -1678,10 +1674,8 @@ void Svy_ResetSurvey (void) Svy.SvyCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Survey_X_reset, - Svy.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Survey_X_reset, + Svy.Title); /***** Show surveys again *****/ Svy_ListAllSurveys (&SvyQst); @@ -1715,10 +1709,8 @@ void Svy_HideSurvey (void) Svy.SvyCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Survey_X_is_now_hidden, - Svy.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Survey_X_is_now_hidden, + Svy.Title); /***** Show surveys again *****/ Svy_ListAllSurveys (&SvyQst); @@ -1752,10 +1744,8 @@ void Svy_UnhideSurvey (void) Svy.SvyCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Survey_X_is_now_visible, - Svy.Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Survey_X_is_now_visible, + Svy.Title); /***** Show surveys again *****/ Svy_ListAllSurveys (&SvyQst); @@ -2204,16 +2194,14 @@ void Svy_RecFormSurvey (void) if (Svy_CheckIfSimilarSurveyExists (&NewSvy)) { NewSurveyIsCorrect = false; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Already_existed_a_survey_with_the_title_X, - NewSvy.Title); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_survey_with_the_title_X, + NewSvy.Title); } } else // If there is not a survey title { NewSurveyIsCorrect = false; - Ale_ShowA_old (Ale_WARNING,Txt_You_must_specify_the_title_of_the_survey); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_title_of_the_survey); } /***** Create a new survey or update an existing one *****/ @@ -2287,10 +2275,8 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt) Svy_CreateGrps (Svy->SvyCod); /***** Write success message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Created_new_survey_X, - Svy->Title); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_survey_X, + Svy->Title); } /*****************************************************************************/ @@ -2327,7 +2313,7 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt) Svy_CreateGrps (Svy->SvyCod); /***** Write success message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_survey_has_been_modified); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_survey_has_been_modified); } /*****************************************************************************/ @@ -2887,7 +2873,7 @@ static unsigned Svy_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res) /***** Count number of rows of result *****/ if (NumRows == 0) - Ale_ShowA_old (Ale_ERROR,"Error when getting answers of a question."); + Ale_ShowAlert (Ale_ERROR,"Error when getting answers of a question."); return (unsigned) NumRows; } @@ -3002,7 +2988,7 @@ void Svy_ReceiveQst (void) { if (ThereIsEndOfAnswers) { - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); Error = true; } else @@ -3014,20 +3000,20 @@ void Svy_ReceiveQst (void) { if (NumLastAns < 1) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); Error = true; } } } else // If first answer is empty { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); Error = true; } } else { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_the_stem_of_the_question); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_the_stem_of_the_question); Error = true; } @@ -3090,7 +3076,7 @@ void Svy_ReceiveQst (void) } /***** List the questions of this survey, including the new one just inserted into the database *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_survey_has_been_modified); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_survey_has_been_modified); } /***** Free answers *****/ @@ -3299,7 +3285,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy, } } else // This survey has no questions - Ale_ShowA_old (Ale_INFO,Txt_This_survey_has_no_questions); + Ale_ShowAlert (Ale_INFO,Txt_This_survey_has_no_questions); if (Svy->Status.ICanEdit && // I can edit (!NumQsts || // This survey has no questions @@ -3621,7 +3607,7 @@ void Svy_RemoveQst (void) SvyCod,SvyQst.QstInd); /***** Write message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Question_removed); + Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); /***** Show current survey *****/ Svy_ShowOneSurvey (SvyCod,&SvyQst,true); @@ -3650,12 +3636,12 @@ void Svy_ReceiveSurveyAnswers (void) /***** Check if I have no answered this survey formerly *****/ if (Svy.Status.IHaveAnswered) - Ale_ShowA_old (Ale_WARNING,Txt_You_already_answered_this_survey_before); + Ale_ShowAlert (Ale_WARNING,Txt_You_already_answered_this_survey_before); else { /***** Receive and store user's answers *****/ Svy_ReceiveAndStoreUserAnswersToASurvey (Svy.SvyCod); - Ale_ShowA_old (Ale_SUCCESS,Txt_Thanks_for_answering_the_survey); + Ale_ShowAlert (Ale_SUCCESS,Txt_Thanks_for_answering_the_survey); } /***** Show current survey *****/ diff --git a/swad_test.c b/swad_test.c index d101718d..26a08898 100644 --- a/swad_test.c +++ b/swad_test.c @@ -389,7 +389,7 @@ void Tst_ShowFormAskTst (void) else { /***** Warning message *****/ - Ale_ShowA_old (Ale_INFO,Txt_No_test_questions); + Ale_ShowAlert (Ale_INFO,Txt_No_test_questions); /***** Button to create a new question *****/ if (Tst_CheckIfICanEditTests ()) @@ -445,7 +445,7 @@ void Tst_ShowNewTest (void) /***** Get questions *****/ if ((NumRows = Tst_GetQuestionsForTest (&mysql_res)) == 0) // Query database { - Ale_ShowA_old (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); + Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); Tst_ShowFormAskTst (); // Show the form again } else @@ -590,16 +590,12 @@ void Tst_AssessTest (void) Tst_SetTstStatus (NumTst,Tst_STATUS_ASSESSED); break; case Tst_STATUS_ASSESSED: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_test_X_has_already_been_assessed_previously, - NumTst); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_The_test_X_has_already_been_assessed_previously, + NumTst); break; case Tst_STATUS_ERROR: - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_was_an_error_in_assessing_the_test_X, - NumTst); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_There_was_an_error_in_assessing_the_test_X, + NumTst); break; } } @@ -712,16 +708,14 @@ static bool Tst_CheckIfNextTstAllowed (void) if (NumSecondsFromNowToNextAccTst > 0) { /***** Write warning *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - "%s:
." - "", - Txt_You_can_not_take_a_new_test_until, - (long) TimeNextTestUTC, - (unsigned) Gbl.Prefs.DateFormat,Txt_Today); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,"%s:
." + "", + Txt_You_can_not_take_a_new_test_until, + (long) TimeNextTestUTC, + (unsigned) Gbl.Prefs.DateFormat,Txt_Today); return false; } @@ -1344,7 +1338,7 @@ void Tst_ShowFormAskEditTsts (void) else // No test questions { /***** Warning message *****/ - Ale_ShowA_old (Ale_INFO,Txt_No_test_questions); + Ale_ShowAlert (Ale_INFO,Txt_No_test_questions); /***** Button to create a new question *****/ Tst_PutButtonToAddQuestion (); @@ -1397,7 +1391,7 @@ void Tst_ShowFormAskSelectTstsForGame (long GamCod) else // No test questions { /***** Warning message *****/ - Ale_ShowA_old (Ale_INFO,Txt_No_test_questions); + Ale_ShowAlert (Ale_INFO,Txt_No_test_questions); /***** Button to create a new question *****/ Tst_PutButtonToAddQuestion (); @@ -1475,7 +1469,7 @@ void Tst_ShowFormConfig (void) /***** If current course has tests and pluggable is unknown... *****/ if (Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown ()) - Ale_ShowA_old (Ale_WARNING,Txt_Please_specify_if_you_allow_access_to_test_questions_from_mobile_applications); + Ale_ShowAlert (Ale_WARNING,Txt_Please_specify_if_you_allow_access_to_test_questions_from_mobile_applications); /***** Form to configure test *****/ Tst_ShowFormConfigTst (); @@ -1550,12 +1544,8 @@ void Tst_RenameTag (void) /***** Check that the new tag is not empty *****/ if (!NewTagTxt[0]) // New tag empty - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_can_not_leave_the_name_of_the_tag_X_empty, - OldTagTxt); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_name_of_the_tag_X_empty, + OldTagTxt); else // New tag not empty { /***** Check if the old tag is equal to the new one *****/ @@ -1563,12 +1553,8 @@ void Tst_RenameTag (void) // are exactly the same (case sensitively). // This happens when user press INTRO // without changing anything in the form. - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_tag_X_has_not_changed, - NewTagTxt); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_The_tag_X_has_not_changed, + NewTagTxt); else // The old and the new tag // are not exactly the same (case sensitively). { @@ -1647,10 +1633,8 @@ void Tst_RenameTag (void) } /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_tag_X_has_been_renamed_as_Y, - OldTagTxt,NewTagTxt); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_tag_X_has_been_renamed_as_Y, + OldTagTxt,NewTagTxt); } } @@ -1855,7 +1839,7 @@ static void Tst_ShowFormEditTags (void) Box_EndBoxTable (); } else - Ale_ShowA_old (Ale_INFO,Txt_No_test_questions); + Ale_ShowAlert (Ale_INFO,Txt_No_test_questions); /* Free structure that stores the query result */ DB_FreeMySQLResult (&mysql_res); @@ -2257,7 +2241,7 @@ void Tst_ReceiveConfigTst (void) Tst_FeedbackDB[Gbl.Test.Config.Feedback]); /***** Show confirmation message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_The_test_configuration_has_been_updated); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_test_configuration_has_been_updated); /***** Show again the form to configure test *****/ Tst_ShowFormConfig (); @@ -2641,7 +2625,7 @@ static unsigned long Tst_GetQuestions (MYSQL_RES **mysql_res) Query); if (NumRows == 0) - Ale_ShowA_old (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); + Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria); return NumRows; } @@ -3324,7 +3308,7 @@ unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle) Shuffle ? "RAND(NOW())" : "AnsInd"); if (!NumRows) - Ale_ShowA_old (Ale_ERROR,"Error when getting answers of a question."); + Ale_ShowAlert (Ale_ERROR,"Error when getting answers of a question."); return (unsigned) NumRows; } @@ -3574,7 +3558,7 @@ void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod, case Tst_ANS_FLOAT: case Tst_ANS_TRUE_FALSE: case Tst_ANS_TEXT: - Ale_ShowA_old (Ale_WARNING,"Type of answer not valid in a game."); + Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game."); break; case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: @@ -4758,7 +4742,7 @@ static bool Tst_GetParamsTst (Tst_ActionToDoWithQuestions_t ActionToDoWithQuesti /* Check number of tags selected */ if (Tst_CountNumTagsInList () == 0) // If no tags selected... { // ...write alert - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_tags); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_tags); Error = true; } @@ -4776,7 +4760,7 @@ static bool Tst_GetParamsTst (Tst_ActionToDoWithQuestions_t ActionToDoWithQuesti /* Check number of types of answer */ if (Tst_CountNumAnswerTypesInList () == 0) // If no types of answer selected... { // ...write warning alert - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_types_of_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_types_of_answer); Error = true; } break; @@ -4799,10 +4783,8 @@ static bool Tst_GetParamsTst (Tst_ActionToDoWithQuestions_t ActionToDoWithQuesti if (Gbl.Test.NumQsts < Gbl.Test.Config.Min || Gbl.Test.NumQsts > Gbl.Test.Config.Max) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_number_of_questions_must_be_in_the_interval_X, - Gbl.Test.Config.Min,Gbl.Test.Config.Max); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_The_number_of_questions_must_be_in_the_interval_X, + Gbl.Test.Config.Min,Gbl.Test.Config.Max); Error = true; } break; @@ -6009,7 +5991,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) Gbl.Test.Image.Action == Img_ACTION_CHANGE_IMAGE) && // Replace existing image by new image Gbl.Test.Image.Status != Img_FILE_PROCESSED) { - Ale_ShowA_old (Ale_WARNING,Txt_Error_receiving_or_processing_image); + Ale_ShowAlert (Ale_WARNING,Txt_Error_receiving_or_processing_image); return false; } @@ -6019,14 +6001,14 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) /***** A question must have at least one tag *****/ if (!Gbl.Test.Tags.Num) // There are no tags with text { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_one_tag_for_the_question); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_one_tag_for_the_question); return false; } /***** A question must have a stem*****/ if (!Gbl.Test.Stem.Length) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_the_stem_of_the_question); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_the_stem_of_the_question); return false; } @@ -6036,12 +6018,12 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) case Tst_ANS_INT: if (!Gbl.Test.Answer.Options[0].Text) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_enter_an_integer_value_as_the_correct_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_enter_an_integer_value_as_the_correct_answer); return false; } if (!Gbl.Test.Answer.Options[0].Text[0]) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_enter_an_integer_value_as_the_correct_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_enter_an_integer_value_as_the_correct_answer); return false; } Gbl.Test.Answer.Integer = Tst_GetIntAnsFromStr (Gbl.Test.Answer.Options[0].Text); @@ -6051,13 +6033,13 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) if (!Gbl.Test.Answer.Options[0].Text || !Gbl.Test.Answer.Options[1].Text) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_enter_the_range_of_floating_point_values_allowed_as_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_enter_the_range_of_floating_point_values_allowed_as_answer); return false; } if (!Gbl.Test.Answer.Options[0].Text[0] || !Gbl.Test.Answer.Options[1].Text[0]) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_enter_the_range_of_floating_point_values_allowed_as_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_enter_the_range_of_floating_point_values_allowed_as_answer); return false; } for (i = 0; @@ -6067,7 +6049,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) if (Gbl.Test.Answer.FloatingPoint[0] > Gbl.Test.Answer.FloatingPoint[1]) { - Ale_ShowA_old (Ale_WARNING,Txt_The_lower_limit_of_correct_answers_must_be_less_than_or_equal_to_the_upper_limit); + Ale_ShowAlert (Ale_WARNING,Txt_The_lower_limit_of_correct_answers_must_be_less_than_or_equal_to_the_upper_limit); return false; } Gbl.Test.Answer.NumOptions = 2; @@ -6076,7 +6058,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) if (Gbl.Test.Answer.TF != 'T' && Gbl.Test.Answer.TF != 'F') { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_a_T_F_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_a_T_F_answer); return false; } Gbl.Test.Answer.NumOptions = 1; @@ -6085,12 +6067,12 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) case Tst_ANS_MULTIPLE_CHOICE: if (!Gbl.Test.Answer.Options[0].Text) // If the first answer is empty { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); return false; } if (!Gbl.Test.Answer.Options[0].Text[0]) // If the first answer is empty { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); return false; } @@ -6103,7 +6085,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) { if (ThereIsEndOfAnswers) { - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); return false; } NumLastOpt = NumOpt; @@ -6117,7 +6099,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) if (NumLastOpt < 1) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); return false; } @@ -6128,19 +6110,19 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) break; if (NumOpt > NumLastOpt) { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_mark_an_answer_as_correct); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_mark_an_answer_as_correct); return false; } break; case Tst_ANS_TEXT: if (!Gbl.Test.Answer.Options[0].Text) // If the first answer is empty { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_two_answers); return false; } if (!Gbl.Test.Answer.Options[0].Text[0]) // If the first answer is empty { - Ale_ShowA_old (Ale_WARNING,Txt_You_must_type_at_least_the_first_answer); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_type_at_least_the_first_answer); return false; } @@ -6153,7 +6135,7 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void) { if (ThereIsEndOfAnswers) { - Ale_ShowA_old (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_empty_intermediate_answers); return false; } Gbl.Test.Answer.NumOptions++; @@ -6456,7 +6438,7 @@ void Tst_RemoveQst (void) Lay_ShowErrorAndExit ("The question to be removed does not exist or belongs to another course."); /***** Write message *****/ - Ale_ShowA_old (Ale_SUCCESS,Txt_Question_removed); + Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); /***** Continue editing questions *****/ if (!EditingOnlyThisQst) @@ -6495,11 +6477,9 @@ void Tst_ChangeShuffleQst (void) Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod); /***** Write message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled : - Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling, - Gbl.Test.QstCod); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled : + Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling, + Gbl.Test.QstCod); /***** Continue editing questions *****/ if (EditingOnlyThisQst) @@ -7685,7 +7665,7 @@ void Tst_ShowUsrsTestResults (void) else // If no users are selected... { // ...write warning alert - Ale_ShowA_old (Ale_WARNING,Txt_You_must_select_one_ore_more_users); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_users); // ...and show again the form Tst_SelUsrsToSeeUsrsTestResults (); } diff --git a/swad_test_import.c b/swad_test_import.c index 7341faa7..b4b845b6 100644 --- a/swad_test_import.c +++ b/swad_test_import.c @@ -139,7 +139,7 @@ void TsI_ShowFormImportQstsFromXML (void) Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE); /***** Write help message *****/ - Ale_ShowA_old (Ale_INFO,Txt_You_need_an_XML_file_containing_a_list_of_questions); + Ale_ShowAlert (Ale_INFO,Txt_You_need_an_XML_file_containing_a_list_of_questions); /***** Write a form to import questions *****/ Frm_StartForm (ActImpTstQst); @@ -427,12 +427,8 @@ void TsI_ImportQstsFromXML (void) WrongType = true; if (WrongType) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_file_is_not_X, - "xml"); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_file_is_not_X, + "xml"); else { /* End the reception of XML in a temporary file */ @@ -443,7 +439,7 @@ void TsI_ImportQstsFromXML (void) /***** Get questions from XML file and store them in database *****/ TsI_ReadQuestionsFromXMLFileAndStoreInDB (FileNameXMLTmp); else - Ale_ShowA_old (Ale_WARNING,"Error copying file."); + Ale_ShowAlert (Ale_WARNING,"Error copying file."); } } @@ -677,7 +673,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer) Tbl_EndTable (); } else // TestElem not found - Ale_ShowA_old (Ale_ERROR,"Root element <test> not found."); + Ale_ShowAlert (Ale_ERROR,"Root element <test> not found."); /***** End table *****/ Box_EndBox (); diff --git a/swad_timetable.c b/swad_timetable.c index db4ed0a7..a4720bf0 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -547,7 +547,7 @@ void TT_ShowTimeTable (long UsrCod) if (Gbl.TimeTable.Config.HoursPerDay) TT_DrawTimeTable (); else - Ale_ShowA_old (Ale_INFO,Txt_The_timetable_is_empty); + Ale_ShowAlert (Ale_INFO,Txt_The_timetable_is_empty); /***** Free internal timetable in memory *****/ TT_FreeTimeTable (); @@ -1001,7 +1001,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) DB_FreeMySQLResult (&mysql_res); if (TimeTableIsIncomplete) - Ale_ShowA_old (Ale_INFO,Txt_Incomplete_timetable_for_lack_of_space); + Ale_ShowAlert (Ale_INFO,Txt_Incomplete_timetable_for_lack_of_space); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index ae6c5e20..a357dce2 100644 --- a/swad_user.c +++ b/swad_user.c @@ -268,7 +268,7 @@ void Usr_InformAboutNumClicksBeforePhoto (void) if (Gbl.Usrs.Me.NumAccWithoutPhoto) { if (Gbl.Usrs.Me.NumAccWithoutPhoto >= Pho_MAX_CLICKS_WITHOUT_PHOTO) - Ale_ShowA_old (Ale_WARNING,Txt_You_must_send_your_photo_because_); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_send_your_photo_because_); else if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB) { snprintf (Message,sizeof (Message), @@ -2523,12 +2523,8 @@ void Usr_WelcomeUsr (void) /***** New year greeting *****/ if (Gbl.Now.Date.Day == 1 && Gbl.Now.Date.Month == 1) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_NEW_YEAR_GREETING, - Gbl.Now.Date.Year); - Ale_ShowA_old (Ale_INFO,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_INFO,Txt_NEW_YEAR_GREETING, + Gbl.Now.Date.Year); /***** Birthday congratulation *****/ if (Gbl.Usrs.Me.UsrDat.Birthday.Day == Gbl.Now.Date.Day && @@ -2589,7 +2585,7 @@ void Usr_WelcomeUsr (void) else /* The current language is not my preferred language ==> change automatically to my language */ - Ale_ShowA_old (Ale_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]); + Ale_ShowAlert (Ale_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]); } } @@ -2814,13 +2810,9 @@ unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *Lis Wrong = true; if (Wrong) - { /***** String is not a valid user's nickname, email or ID *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_ID_nickname_or_email_X_is_not_valid, - Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_ID_nickname_or_email_X_is_not_valid, + Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail); return ListUsrCods->NumUsrs; } @@ -2922,7 +2914,7 @@ void Usr_ChkUsrAndGetUsrData (void) { Gbl.Action.Act = ActLogOut; Tab_SetCurrentTab (); - Ale_ShowA_old (Ale_WARNING,Txt_The_session_has_expired); + Ale_ShowAlert (Ale_WARNING,Txt_The_session_has_expired); FormLogin.PutForm = true; } } @@ -3237,7 +3229,7 @@ static void Usr_ShowAlertUsrDoesNotExistsOrWrongPassword (void) // Gbl.Action.Act = ActFrmLogIn; // Tab_SetCurrentTab (); - Ale_ShowA_old (Ale_WARNING,Txt_The_user_does_not_exist_or_password_is_incorrect); + Ale_ShowAlert (Ale_WARNING,Txt_The_user_does_not_exist_or_password_is_incorrect); } /*****************************************************************************/ @@ -3250,10 +3242,8 @@ static void Usr_ShowAlertThereAreMoreThanOneUsr (void) Gbl.Action.Act = ActFrmLogIn; Tab_SetCurrentTab (); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_are_more_than_one_user_with_the_ID_X_Please_type_a_nick_or_email, - Gbl.Usrs.Me.UsrIdLogin); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_There_are_more_than_one_user_with_the_ID_X_Please_type_a_nick_or_email, + Gbl.Usrs.Me.UsrIdLogin); } /*****************************************************************************/ @@ -3347,13 +3337,9 @@ void Usr_ShowFormsLogoutAndRole (void) /***** Write message with my new logged role *****/ if (Gbl.Usrs.Me.Role.HasChanged) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_You_are_now_LOGGED_IN_as_X, - Txt_logged[Gbl.Usrs.Me.UsrDat.Sex], - Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]); - Ale_ShowA_old (Ale_SUCCESS,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_SUCCESS,Txt_You_are_now_LOGGED_IN_as_X, + Txt_logged[Gbl.Usrs.Me.UsrDat.Sex], + Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]); /***** Start box *****/ Box_StartBox (NULL,Txt_Session,Usr_PutLinkToLogOut, @@ -5260,10 +5246,8 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,Sco_Scope_t Sc { if (Gbl.Usrs.LstUsrs[Role].NumUsrs > Cfg_MAX_USRS_IN_LIST) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_list_of_X_users_is_too_large_to_be_displayed, - Gbl.Usrs.LstUsrs[Role].NumUsrs); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_WARNING,Txt_The_list_of_X_users_is_too_large_to_be_displayed, + Gbl.Usrs.LstUsrs[Role].NumUsrs); Abort = true; } else @@ -5658,12 +5642,8 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) else { if (WriteErrorMsgs) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_is_no_user_with_nickname_X, - UsrIDNickOrEmail); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_There_is_no_user_with_nickname_X, + UsrIDNickOrEmail); Error = true; } } @@ -5678,12 +5658,8 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) else { if (WriteErrorMsgs) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_is_no_user_with_email_X, - UsrIDNickOrEmail); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_There_is_no_user_with_email_X, + UsrIDNickOrEmail); Error = true; } } @@ -5707,36 +5683,24 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) if (ListUsrCods.NumUsrs > 1) // Two or more user share the same user's ID {// TODO: Consider forbid IDs here if (WriteErrorMsgs) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_are_more_than_one_user_with_the_ID_X_Please_type_a_nick_or_email, - UsrIDNickOrEmail); - Ale_ShowA_old (Ale_ERROR,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_ERROR,Txt_There_are_more_than_one_user_with_the_ID_X_Please_type_a_nick_or_email, + UsrIDNickOrEmail); Error = true; } } else // No users found { if (WriteErrorMsgs) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_is_no_user_with_ID_nick_or_email_X, - UsrIDNickOrEmail); - Ale_ShowA_old (Ale_ERROR,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_ERROR,Txt_There_is_no_user_with_ID_nick_or_email_X, + UsrIDNickOrEmail); Error = true; } } else // String is not a valid user's nickname, email or ID { if (WriteErrorMsgs) - { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_ID_nickname_or_email_X_is_not_valid, - UsrIDNickOrEmail); - Ale_ShowA_old (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_ID_nickname_or_email_X_is_not_valid, + UsrIDNickOrEmail); Error = true; } } @@ -8539,7 +8503,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role) Btn_CREATE_BUTTON,Txt_Register_teacher); else /***** Show alert *****/ - Ale_ShowA_old (Ale_INFO,Txt_No_users_found[Role]); + Ale_ShowAlert (Ale_INFO,Txt_No_users_found[Role]); } /*****************************************************************************/ @@ -9135,7 +9099,7 @@ void Usr_PrintUsrQRCode (void) Box_EndBox (); } 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_); } /*****************************************************************************/ diff --git a/swad_zip.c b/swad_zip.c index 8472b7cc..31cb01af 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -454,9 +454,9 @@ static void ZIP_CompressFolderIntoZIP (void) UncompressedSize = ZIP_CloneDir (Path,PathCompression,Gbl.FileBrowser.Priv.FullPathInTree); if (UncompressedSize == 0) // Nothing to compress - Ale_ShowA_old (Ale_WARNING,Txt_The_folder_is_empty); + Ale_ShowAlert (Ale_WARNING,Txt_The_folder_is_empty); else if (UncompressedSize > ZIP_MAX_SIZE_UNCOMPRESSED) // Uncompressed size is too big - Ale_ShowA_old (Ale_WARNING,Txt_The_contents_of_the_folder_are_too_big); + Ale_ShowAlert (Ale_WARNING,Txt_The_contents_of_the_folder_are_too_big); else { /***** Change to directory of the clone folder