From 59ae205953bf6ab2fabcf63a7669ff7c936564ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 26 Mar 2017 00:20:34 +0100 Subject: [PATCH] Version 16.167.4 --- swad_action.c | 2 +- swad_changelog.h | 3 ++- swad_holiday.c | 28 +++++++++++++++++++--------- swad_holiday.h | 3 ++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/swad_action.c b/swad_action.c index 4b88d66c9..b1b203901 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1645,7 +1645,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeHld */{ 707,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x1FF, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_SeeHolidays ,NULL}, /* ActEdiHld */{ 713,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_EditHolidays ,NULL}, - /* ActNewHld */{ 714,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_RecFormNewHoliday ,NULL}, + /* ActNewHld */{ 714,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Hld_RecFormNewHoliday1 ,Hld_RecFormNewHoliday2 ,NULL}, /* ActRemHld */{ 716,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_RemoveHoliday ,NULL}, /* ActChgHldPlc */{ 896,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_ChangeHolidayPlace ,NULL}, /* ActChgHldTyp */{ 715,-1,TabUnk,ActSeeCalIns , 0, 0, 0, 0,0x180, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Hld_ChangeHolidayType ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 368f4743b..c5d195aba 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -209,13 +209,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.167.3 (2017-03-24)" +#define Log_PLATFORM_VERSION "SWAD 16.167.4 (2017-03-26)" #define CSS_FILE "swad16.166.css" #define JS_FILE "swad16.144.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.167.4: Mar 26, 2017 Changes in edition of holidays. (217643 lines) Version 16.167.3: Mar 25, 2017 Changes in edition of holidays. (217632 lines) Version 16.167.2: Mar 25, 2017 Contextual link to holidays is changed to a left-top contextual icon. (217577 lines) Version 16.167.1: Mar 25, 2017 Changes in icons related to calendar and holidays. (217595 lines) diff --git a/swad_holiday.c b/swad_holiday.c index a4cfe8a26..b0dec1ac3 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -1073,8 +1073,9 @@ static void Hld_PutHeadHolidays (void) /******************* Receive form to create a new holiday ********************/ /*****************************************************************************/ -void Hld_RecFormNewHoliday (void) +void Hld_RecFormNewHoliday1 (void) { + extern const char *Txt_Created_new_holiday_X; extern const char *Txt_You_must_specify_the_name_of_the_new_holiday; struct Holiday *Hld; @@ -1115,14 +1116,29 @@ void Hld_RecFormNewHoliday (void) /***** Get holiday name *****/ Par_GetParToText ("Name",Hld->Name,Hld_MAX_BYTES_HOLIDAY_NAME); - /***** Create the new holiday or write warning message *****/ + /***** Create the new holiday or set warning message *****/ if (Hld->Name[0]) // If there's a holiday name + { + /* Create the new holiday */ Hld_CreateHoliday (Hld); + + /* Success message */ + sprintf (Gbl.Message,Txt_Created_new_holiday_X,Hld->Name); + } else // If there is not a holiday name { + /* Error message */ + Gbl.Error = true; sprintf (Gbl.Message,"%s",Txt_You_must_specify_the_name_of_the_new_holiday); - Lay_ShowAlert (Lay_WARNING,Gbl.Message); } + } + +void Hld_RecFormNewHoliday2 (void) + { + /***** Write error/success message *****/ + Lay_ShowAlert (Gbl.Error ? Lay_WARNING : + Lay_SUCCESS, + Gbl.Message); /***** Show the form again *****/ Hld_EditHolidays (); @@ -1134,7 +1150,6 @@ void Hld_RecFormNewHoliday (void) static void Hld_CreateHoliday (struct Holiday *Hld) { - extern const char *Txt_Created_new_holiday_X; char Query[256 + Hld_MAX_BYTES_HOLIDAY_NAME]; /***** Create a new holiday or no school period *****/ @@ -1151,9 +1166,4 @@ static void Hld_CreateHoliday (struct Holiday *Hld) Hld->EndDate.Day, Hld->Name); DB_QueryINSERT (Query,"can not create holiday"); - - /***** Write success message *****/ - sprintf (Gbl.Message,Txt_Created_new_holiday_X, - Hld->Name); - Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); } diff --git a/swad_holiday.h b/swad_holiday.h index b18e2fb01..3653bfea5 100644 --- a/swad_holiday.h +++ b/swad_holiday.h @@ -86,6 +86,7 @@ void Hld_ChangeHolidayType (void); void Hld_ChangeStartDate (void); void Hld_ChangeEndDate (void); void Hld_RenameHoliday (void); -void Hld_RecFormNewHoliday (void); +void Hld_RecFormNewHoliday1 (void); +void Hld_RecFormNewHoliday2 (void); #endif