diff --git a/swad_action.c b/swad_action.c index 32e2eb9a..6ce18d58 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1828,14 +1828,14 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRenDegTyp */{ 538,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x200, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,DT_RenameDegreeType ,DT_ContEditAfterChgDegTyp ,NULL}, /* ActEdiDeg */{ 536,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_EditDegrees ,NULL}, - /* ActReqDeg */{1206,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RecFormReqDeg ,NULL}, - /* ActNewDeg */{ 540,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RecFormNewDeg ,NULL}, - /* ActRemDeg */{ 542,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RemoveDegree ,NULL}, + /* ActReqDeg */{1206,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RecFormReqDeg ,Deg_ContEditAfterChgDeg ,NULL}, + /* ActNewDeg */{ 540,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RecFormNewDeg ,Deg_ContEditAfterChgDeg ,NULL}, + /* ActRemDeg */{ 542,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RemoveDegree ,Deg_ContEditAfterChgDeg ,NULL}, /* ActRenDegSho */{ 546,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeShort ,Deg_ContEditAfterChgDeg ,NULL}, /* ActRenDegFul */{ 547,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeFull ,Deg_ContEditAfterChgDeg ,NULL}, - /* ActChgDegTyp */{ 544,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegreeType ,NULL}, - /* ActChgDegWWW */{ 554,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegWWW ,NULL}, - /* ActChgDegSta */{1207,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegStatus ,NULL}, + /* ActChgDegTyp */{ 544,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegreeType ,Deg_ContEditAfterChgDeg ,NULL}, + /* ActChgDegWWW */{ 554,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegWWW ,Deg_ContEditAfterChgDeg ,NULL}, + /* ActChgDegSta */{1207,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegStatus ,Deg_ContEditAfterChgDeg ,NULL}, /* ActEdiCla */{1745,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_EditClassrooms ,NULL}, /* ActNewCla */{1746,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_RecFormNewClassroom ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 55f329a9..f4f3a2a6 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -464,11 +464,12 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.101.2 (2019-04-08)" +#define Log_PLATFORM_VERSION "SWAD 18.101.3 (2019-04-08)" #define CSS_FILE "swad18.92.css" #define JS_FILE "swad18.92.js" /* -En degree, centre, institution y country, hacer más funciones a priori al estilo de como está hecha la edición de course +En centre, institution y country, hacer más funciones a priori al estilo de como está hecha la edición de course + Version 18.101.3: Apr 08, 2019 Code refactoring in edition of degrees. (241924 lines) Version 18.101.2: Apr 08, 2019 Code refactoring in edition of degree types. Fixed bug in alerts. (241936 lines) Version 18.101.1: Apr 08, 2019 Code refactoring in edition of courses. (241921 lines) diff --git a/swad_course.c b/swad_course.c index 21809f3b..bf94afb0 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1903,6 +1903,7 @@ void Crs_RecFormNewCrs (void) static void Crs_RecFormRequestOrCreateCrs (unsigned Status) { extern const char *Txt_The_course_X_already_exists; + extern const char *Txt_Created_new_course_X; extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course; extern const char *Txt_The_year_X_is_not_allowed; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; @@ -1934,7 +1935,12 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status) Txt_The_course_X_already_exists, Crs_EditingCrs->FullName); else // Add new requested course to database + { Crs_CreateCourse (Status); + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_Created_new_course_X, + Crs_EditingCrs->FullName); + } } else // If there is not a course name Ale_CreateAlert (Ale_WARNING,NULL, @@ -1975,8 +1981,6 @@ static void Crs_GetParamsNewCourse (struct Course *Crs) static void Crs_CreateCourse (unsigned Status) { - extern const char *Txt_Created_new_course_X; - /***** Insert new course into pending requests *****/ Crs_EditingCrs->CrsCod = DB_QueryINSERTandReturnCode ("can not create a new course", @@ -1992,11 +1996,6 @@ static void Crs_CreateCourse (unsigned Status) Gbl.Usrs.Me.UsrDat.UsrCod, Crs_EditingCrs->ShrtName, Crs_EditingCrs->FullName); - - /***** Create success message *****/ - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_Created_new_course_X, - Crs_EditingCrs->FullName); } /*****************************************************************************/ @@ -2825,7 +2824,7 @@ void Crs_ChangeCrsStatus (void) } /*****************************************************************************/ -/************* Show message of success after changing a course ***************/ +/********* Show alerts after changing a course and continue editing **********/ /*****************************************************************************/ void Crs_ContEditAfterChgCrs (void) diff --git a/swad_degree.c b/swad_degree.c index 8826585d..efc83576 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -122,6 +122,7 @@ static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *N static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod); static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]); +static void Deg_ShowAlertAndButtonToGoToDeg (void); static void Deg_PutParamGoToDeg (void); static void Deg_EditingDegreeConstructor (void); @@ -1144,8 +1145,6 @@ unsigned Deg_ConvStrToYear (const char *StrYear) static void Deg_CreateDegree (unsigned Status) { - extern const char *Txt_Created_new_degree_X; - /***** Create a new degree *****/ Deg_EditingDeg->DegCod = DB_QueryINSERTandReturnCode ("can not create a new degree", @@ -1159,13 +1158,6 @@ static void Deg_CreateDegree (unsigned Status) Deg_EditingDeg->ShrtName, Deg_EditingDeg->FullName, Deg_EditingDeg->WWW); - - /***** Write message to show the change made - and put button to go to degree created *****/ - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_Created_new_degree_X, - Deg_EditingDeg->FullName); - Deg_ShowAlertAndButtonToGoToDeg (); } /*****************************************************************************/ @@ -1553,9 +1545,6 @@ void Deg_RecFormReqDeg (void) /***** Receive form to request a new degree *****/ Deg_RecFormRequestOrCreateDeg ((unsigned) Deg_STATUS_BIT_PENDING); - - /***** Degree destructor *****/ - Deg_EditingDegreeDestructor (); } /*****************************************************************************/ @@ -1581,6 +1570,7 @@ void Deg_RecFormNewDeg (void) static void Deg_RecFormRequestOrCreateDeg (unsigned Status) { extern const char *Txt_The_degree_X_already_exists; + extern const char *Txt_Created_new_degree_X; extern const char *Txt_You_must_specify_the_web_address_of_the_new_degree; extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree; @@ -1608,23 +1598,29 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status) /***** If name of degree was in database... *****/ if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Deg_EditingDeg->ShrtName, -1L,Deg_EditingDeg->CtrCod)) - Ale_ShowAlert (Ale_WARNING,Txt_The_degree_X_already_exists, - Deg_EditingDeg->ShrtName); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_The_degree_X_already_exists, + Deg_EditingDeg->ShrtName); else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Deg_EditingDeg->FullName, -1L,Deg_EditingDeg->CtrCod)) - Ale_ShowAlert (Ale_WARNING,Txt_The_degree_X_already_exists, - Deg_EditingDeg->FullName); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_The_degree_X_already_exists, + Deg_EditingDeg->FullName); else // Add new degree to database + { Deg_CreateDegree (Status); + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_Created_new_degree_X, + Deg_EditingDeg->FullName); + } } else // If there is not a degree logo or web - Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_degree); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_You_must_specify_the_web_address_of_the_new_degree); } else // If there is not a degree name - Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); - - /***** Show the form again *****/ - Deg_EditDegreesInternal (); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); } /*****************************************************************************/ @@ -1647,22 +1643,18 @@ void Deg_RemoveDegree (void) /***** Check if this degree has courses *****/ if (Crs_GetNumCrssInDeg (Deg_EditingDeg->DegCod)) // Degree has courses ==> don't remove - Ale_ShowAlert (Ale_WARNING,Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree); else // Degree has no courses ==> remove it { /***** Remove degree *****/ Deg_RemoveDegreeCompletely (Deg_EditingDeg->DegCod); /***** Write message to show the change made *****/ - Ale_ShowAlert (Ale_SUCCESS,Txt_Degree_X_removed, - Deg_EditingDeg->FullName); + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_Degree_X_removed, + Deg_EditingDeg->FullName); } - - /***** Show the form again *****/ - Deg_EditDegreesInternal (); - - /***** Degree destructor *****/ - Deg_EditingDegreeDestructor (); } /*****************************************************************************/ @@ -1961,19 +1953,6 @@ void Deg_RenameDegreeFull (void) Deg_RenameDegree (Deg_EditingDeg,Cns_FULL_NAME); } -void Deg_ContEditAfterChgDeg (void) - { - /***** Write message to show the change made - and put button to go to degree changed *****/ - Deg_ShowAlertAndButtonToGoToDeg (); - - /***** Show the form again *****/ - Deg_EditDegreesInternal (); - - /***** Degree destructor *****/ - Deg_EditingDegreeDestructor (); - } - /*****************************************************************************/ /*************** Change the name of a degree in configuration ****************/ /*****************************************************************************/ @@ -2192,18 +2171,11 @@ void Deg_ChangeDegreeType (void) NewDegTypCod,Deg_EditingDeg->DegCod); Deg_EditingDeg->DegTypCod = NewDegTypCod; - /***** Write alert to show the change made + /***** Create alert to show the change made and put button to go to degree changed *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_type_of_degree_of_the_degree_X_has_changed, Deg_EditingDeg->FullName); - Deg_ShowAlertAndButtonToGoToDeg (); - - /***** Show the form again *****/ - Deg_EditDegreesInternal (); - - /***** Degree destructor *****/ - Deg_EditingDegreeDestructor (); } /*****************************************************************************/ @@ -2242,16 +2214,10 @@ void Deg_ChangeDegWWW (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_new_web_address_is_X, NewWWW); - Deg_ShowAlertAndButtonToGoToDeg (); } else - Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); - - /***** Show the form again *****/ - Deg_EditDegreesInternal (); - - /***** Degree destructor *****/ - Deg_EditingDegreeDestructor (); + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_You_can_not_leave_the_web_address_empty); } void Deg_ChangeDegWWWInConfig (void) @@ -2337,6 +2303,16 @@ void Deg_ChangeDegStatus (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_status_of_the_degree_X_has_changed, Deg_EditingDeg->ShrtName); + } + +/*****************************************************************************/ +/********* Show alerts after changing a course and continue editing **********/ +/*****************************************************************************/ + +void Deg_ContEditAfterChgDeg (void) + { + /***** Write message to show the change made + and put button to go to degree changed *****/ Deg_ShowAlertAndButtonToGoToDeg (); /***** Show the form again *****/ @@ -2351,7 +2327,7 @@ void Deg_ChangeDegStatus (void) /***************** and put button to go to degree changed ********************/ /*****************************************************************************/ -void Deg_ShowAlertAndButtonToGoToDeg (void) +static void Deg_ShowAlertAndButtonToGoToDeg (void) { extern const char *Txt_Go_to_X; diff --git a/swad_degree.h b/swad_degree.h index 2b004080..6d584c45 100644 --- a/swad_degree.h +++ b/swad_degree.h @@ -129,7 +129,6 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod); void Deg_RemoveDegreeCompletely (long DegCod); void Deg_RenameDegreeShort (void); void Deg_RenameDegreeFull (void); -void Deg_ContEditAfterChgDeg (void); void Deg_RenameDegreeShortInConfig (void); void Deg_RenameDegreeFullInConfig (void); void Deg_ChangeDegCtrInConfig (void); @@ -138,8 +137,7 @@ void Deg_ChangeDegreeType (void); void Deg_ChangeDegWWW (void); void Deg_ChangeDegWWWInConfig (void); void Deg_ChangeDegStatus (void); - -void Deg_ShowAlertAndButtonToGoToDeg (void); +void Deg_ContEditAfterChgDeg (void); void Deg_RequestLogo (void); void Deg_ReceiveLogo (void);