diff --git a/swad_centre.c b/swad_centre.c index 6fddead77..e9553c483 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1957,8 +1957,7 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull if (Ctr_CheckIfCtrNameExistsInIns (ParamName,NewCtrName,Ctr->CtrCod,Gbl.CurrentIns.Ins.InsCod)) { Gbl.AlertType = Lay_WARNING; - sprintf (Gbl.Message,Txt_The_centre_X_already_exists, - NewCtrName); + sprintf (Gbl.Message,Txt_The_centre_X_already_exists,NewCtrName); } else { diff --git a/swad_changelog.h b/swad_changelog.h index d7b82776f..0c36733f3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -234,13 +234,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.208.5 (2017-05-08)" +#define Log_PLATFORM_VERSION "SWAD 16.208.6 (2017-05-08)" #define CSS_FILE "swad16.207.css" #define JS_FILE "swad16.206.3.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.208.6: May 09, 2017 Changes in alerts. + Changes in layout of student records. (218744 lines) Version 16.208.5: May 09, 2017 Changes in edition of students records. (218750 lines) Version 16.208.4: May 08, 2017 Changes in edition of students records. (218728 lines) Version 16.208.3: May 08, 2017 Changes in edition of students records. (218713 lines) diff --git a/swad_enrolment.c b/swad_enrolment.c index ed506fee8..261080ee6 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -3564,8 +3564,7 @@ void Enr_CreateNewUsr1 (void) ID_GetParamOtherUsrIDPlain (); // User's ID was already modified and passed as a hidden parameter /***** Initialize alert type and message *****/ - Gbl.AlertType = Lay_INFO; // No error, no success - Gbl.Message[0] = '\0'; // Do not write anything + Gbl.AlertType = Lay_NONE; // Do not show alert if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID)) // User's ID valid { @@ -3639,9 +3638,8 @@ void Enr_CreateNewUsr2 (void) { if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected { - /***** Show success message *****/ - if (Gbl.Message[0]) - Lay_ShowAlert (Gbl.AlertType,Gbl.Message); + /***** Show optional alert *****/ + Lay_ShowAlert (Gbl.AlertType,Gbl.Message); /***** Change user's groups *****/ if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups? @@ -3667,8 +3665,7 @@ void Enr_ModifyUsr1 (void) Rol_Role_t NewRole; /***** Initialize alert type and message *****/ - Gbl.AlertType = Lay_INFO; // No error, no success - Gbl.Message[0] = '\0'; // Do not write anything + Gbl.AlertType = Lay_NONE; // Do not show alert /***** Get user from form *****/ if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) @@ -3709,7 +3706,7 @@ void Enr_ModifyUsr1 (void) /* Modify role */ Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole); - /* Show success message */ + /* Set success message */ Gbl.AlertType = Lay_SUCCESS; sprintf (Gbl.Message,Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B, Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName, @@ -3723,7 +3720,7 @@ void Enr_ModifyUsr1 (void) Enr_RegisterUsrInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole, Enr_SET_ACCEPTED_TO_FALSE); - /* Show success message */ + /* Set success message */ Gbl.AlertType = Lay_SUCCESS; sprintf (Gbl.Message,Txt_THE_USER_X_has_been_enroled_in_the_course_Y, Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); @@ -3796,9 +3793,8 @@ void Enr_ModifyUsr2 (void) case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: if (Gbl.CurrentCrs.Crs.CrsCod > 0) { - /***** Show success message *****/ - if (Gbl.Message[0]) - Lay_ShowAlert (Gbl.AlertType,Gbl.Message); + /***** Show optional alert *****/ + Lay_ShowAlert (Gbl.AlertType,Gbl.Message); /***** Change user's groups *****/ if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups? diff --git a/swad_global.c b/swad_global.c index 329da8b16..e79af0eba 100644 --- a/swad_global.c +++ b/swad_global.c @@ -117,10 +117,10 @@ void Gbl_InitializeGlobals (void) Gbl.F.XML = NULL; Gbl.F.Rep = NULL; // Report - Gbl.Form.Num = -1; // Number of form. It's increased by 1 at the begin of each form - Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms + Gbl.Form.Num = -1; // Number of form. It's increased by 1 at the begin of each form + Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms - Gbl.AlertType = Lay_SUCCESS; // Used to show alert in a posteriori function + Gbl.AlertType = Lay_NONE; // Used to show alert in a posteriori function Gbl.DB.DatabaseIsOpen = false; Gbl.DB.LockedTables = false; diff --git a/swad_holiday.c b/swad_holiday.c index aaa8865d6..e0d0ff57f 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -652,8 +652,7 @@ void Hld_RemoveHoliday1 (void) /***** Write message to show the change made *****/ Gbl.AlertType = Lay_SUCCESS; - sprintf (Gbl.Message,Txt_Holiday_X_removed, - Hld.Name); + sprintf (Gbl.Message,Txt_Holiday_X_removed,Hld.Name); } diff --git a/swad_layout.c b/swad_layout.c index bc2912fa9..936e399eb 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -68,12 +68,13 @@ extern struct Globals Gbl; static const char *Lay_AlertIcons[Lay_NUM_ALERT_TYPES] = { - "info64x64.png", - "success64x64.png", - "question64x64.gif", // animated - "warning64x64.gif", // animated - "error64x64.gif", // animated - "copy_on16x16.gif", + NULL, // Lay_NONE + "info64x64.png", // Lay_INFO + "success64x64.png", // Lay_SUCCESS + "question64x64.gif", // Lay_QUESTION animated gif + "warning64x64.gif", // Lay_WARNING animated gif + "error64x64.gif", // Lay_ERROR animated gif + "copy_on16x16.gif", // Lay_CLIPBOARD }; /*****************************************************************************/ @@ -1665,8 +1666,11 @@ void Lay_ShowErrorAndExit (const char *Message) void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Message) { - Lay_ShowAlertAndButton1 (AlertType,Message); - Lay_ShowAlertAndButton2 (ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL); + if (AlertType != Lay_NONE) + { + Lay_ShowAlertAndButton1 (AlertType,Message); + Lay_ShowAlertAndButton2 (ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL); + } } void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Message) diff --git a/swad_layout.h b/swad_layout.h index 861f82dd5..3dc130791 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -47,15 +47,16 @@ /********************************* Public types ******************************/ /*****************************************************************************/ -#define Lay_NUM_ALERT_TYPES 6 +#define Lay_NUM_ALERT_TYPES 7 typedef enum { - Lay_INFO = 0, - Lay_SUCCESS = 1, - Lay_QUESTION = 2, - Lay_WARNING = 3, - Lay_ERROR = 4, - Lay_CLIPBOARD = 5, + Lay_NONE = 0, + Lay_INFO = 1, + Lay_SUCCESS = 2, + Lay_QUESTION = 3, + Lay_WARNING = 4, + Lay_ERROR = 5, + Lay_CLIPBOARD = 6, } Lay_AlertType_t; typedef enum diff --git a/swad_record.c b/swad_record.c index ac072f8b7..8dd4ce5da 100644 --- a/swad_record.c +++ b/swad_record.c @@ -1102,8 +1102,7 @@ static void Rec_ShowRecordOneStdCrs (void) fprintf (Gbl.F.Out,""); /***** Show optional alert *****/ - if (Gbl.Message[0]) - Lay_ShowAlert (Gbl.AlertType,Gbl.Message); + Lay_ShowAlert (Gbl.AlertType,Gbl.Message); /***** Shared record *****/ Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); @@ -1223,8 +1222,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, /* Show optional alert */ if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user - if (Gbl.Message[0]) - Lay_ShowAlert (Gbl.AlertType,Gbl.Message); + Lay_ShowAlert (Gbl.AlertType,Gbl.Message); /* Shared record */ Rec_ShowSharedUsrRecord (ShaTypeOfView,&UsrDat); @@ -1571,8 +1569,7 @@ void Rec_UpdateAndShowOtherCrsRecord (void) bool MultipleUsrs; /***** Initialize alert type and message *****/ - Gbl.AlertType = Lay_INFO; // No error, no success - Gbl.Message[0] = '\0'; // Do not write anything + Gbl.AlertType = Lay_NONE; // Do not show alert /***** Get parameter indicating if listing multiple users *****/ MultipleUsrs = Par_GetParToBool ("MultiUsrs"); @@ -1593,7 +1590,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void) /***** Update the record *****/ Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod); Gbl.AlertType = Lay_SUCCESS; - sprintf (Gbl.Message,"%s",Txt_Student_record_card_in_this_course_has_been_updated); + sprintf (Gbl.Message,"%s", + Txt_Student_record_card_in_this_course_has_been_updated); /***** Show one or multiple records *****/ if (MultipleUsrs) @@ -1631,8 +1629,6 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, // Rec_CRS_RECORD_PRINT }; char StrRecordWidth[10 + 1]; - unsigned Col1Width = 210; - unsigned Col2Width; bool ItsMe; bool ICanEdit = false; unsigned NumField; @@ -1701,8 +1697,6 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, break; } - Col2Width = Rec_RECORD_WIDTH - 10 * 2 - Col1Width; - /***** Start frame *****/ sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH); Lay_StartRoundFrameTable (StrRecordWidth,NULL, @@ -1746,12 +1740,11 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, /* Name of the field */ fprintf (Gbl.F.Out,"" - "" + "" "%s:", ICanEditThisField ? The_ClassForm[Gbl.Prefs.Theme] : "REC_DAT_SMALL", - Gbl.RowEvenOdd,Col1Width, + Gbl.RowEvenOdd, Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Name); if (TypeOfView == Rec_CRS_LIST_ONE_RECORD || TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS) @@ -1770,13 +1763,12 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, /***** Write form, text, or nothing depending on the user's role and the visibility of the field *****/ - fprintf (Gbl.F.Out,"", - Gbl.RowEvenOdd,Col2Width); + fprintf (Gbl.F.Out,"", + Gbl.RowEvenOdd); if (ICanEditThisField) // Show with form { fprintf (Gbl.F.Out,"