Version 18.47

This commit is contained in:
Antonio Cañas Vargas 2019-02-17 01:14:55 +01:00
parent 0f1f74a7f1
commit 1316de7f26
42 changed files with 780 additions and 913 deletions

View File

@ -591,7 +591,7 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
Act_Action_t NextAction;
/***** Show possible alert *****/
if (Gbl.Alert.Section == (const char *) ID_ID_SECTION_ID)
if (Gbl.DelayedAlert.Section == (const char *) ID_ID_SECTION_ID)
Ale_ShowDelayedAlert ();
/***** Help message *****/
@ -806,25 +806,25 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
ID_RemoveUsrIDFromDB (UsrDat->UsrCod,UsrID);
/***** Show message *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_ID_X_removed,
UsrID);
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_You_can_not_delete_this_ID,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_this_ID,
Ale_MAX_BYTES_ALERT);
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -944,9 +944,9 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
{
if (ItsMe || UsrDat->IDs.List[NumIDFound].Confirmed)
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_matches_one_of_the_existing,
NewID);
}
@ -955,18 +955,18 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
/***** Mark this ID as confirmed *****/
ID_ConfirmUsrID (UsrDat,NewID);
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_has_been_confirmed,
NewID);
}
}
else if (UsrDat->IDs.Num >= ID_MAX_IDS_PER_USER)
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_A_user_can_not_have_more_than_X_IDs,
ID_MAX_IDS_PER_USER);
}
@ -977,27 +977,27 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
// Not me ==> ID confirmed
ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe);
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_has_been_registered_successfully,
NewID);
}
}
else // New ID is not valid
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_is_not_valid,
NewID);
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -1072,9 +1072,9 @@ void ID_ConfirmOtherUsrID (void)
if (Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed)
{
/***** ID found and already confirmed *****/
Gbl.Alert.Type = Ale_INFO;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_ID_X_had_already_been_confirmed,
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
}
@ -1086,26 +1086,26 @@ void ID_ConfirmOtherUsrID (void)
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed = true;
/***** Write success message *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_has_been_confirmed,
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
}
}
else // User's ID not found
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
else // I can not confirm
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
@ -1126,7 +1126,7 @@ void ID_ConfirmOtherUsrID (void)
break;
default:
/* Show optional alert */
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/* Show only the updated record of this user */
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,

View File

@ -1258,7 +1258,6 @@ void Agd_AskRemEvent (void)
extern const char *Txt_Do_you_really_want_to_remove_the_event_X;
extern const char *Txt_Remove_event;
struct AgendaEvent AgdEvent;
char *Txt;
/***** Get parameters *****/
Agd_GetParams (Agd_MY_AGENDA);
@ -1273,14 +1272,11 @@ void Agd_AskRemEvent (void)
/***** Show question and button to remove event *****/
Gbl.Agenda.AgdCodToEdit = AgdEvent.AgdCod;
if (asprintf (&Txt,Txt_Do_you_really_want_to_remove_the_event_X,
AgdEvent.Event) < 0)
Lay_NotEnoughMemoryExit ();
Ale_ShowAlertAndButton (Ale_QUESTION,Txt,
ActRemEvtMyAgd,NULL,NULL,
Ale_ShowAlertAndButton (ActRemEvtMyAgd,NULL,NULL,
Agd_PutCurrentParamsMyAgenda,
Btn_REMOVE_BUTTON,Txt_Remove_event);
free ((void *) Txt);
Btn_REMOVE_BUTTON,Txt_Remove_event,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_event_X,
AgdEvent.Event);
/***** Show events again *****/
Agd_ShowMyAgenda ();

View File

@ -70,31 +70,17 @@ static const char *Ale_AlertIcons[Ale_NUM_ALERT_TYPES] =
static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt);
static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt);
/*****************************************************************************/
/******************************** Reset alert ********************************/
/*************************** Reset delayed alert *****************************/
/*****************************************************************************/
void Ale_ResetAlert (void)
void Ale_ResetDelayedAlert (void)
{
Gbl.Alert.Type = Ale_NONE; // Reset alert
Gbl.Alert.Section = NULL;
Gbl.Alert.Txt[0] = '\0';
}
/*****************************************************************************/
/*********************** Show a write-pending alert **************************/
/*****************************************************************************/
// Gbl.Alert.Type must be Ale_NONE or any type of alert
// If Gbl.Alert.Type != Ale_NONE ==> Gbl.Alert.Txt must hold the message
void Ale_ShowPendingAlert (void)
{
/***** Anything to show? *****/
if (Gbl.Alert.Type != Ale_NONE)
/***** Show alert *****/
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
Ale_ResetAlert ();
Gbl.DelayedAlert.Type = Ale_NONE; // Reset alert
Gbl.DelayedAlert.Section = NULL;
Gbl.DelayedAlert.Txt[0] = '\0';
}
/*****************************************************************************/
@ -105,6 +91,8 @@ void Ale_ShowDelayedAlert (void)
{
if (Gbl.DelayedAlert.Type != Ale_NONE)
Ale_ShowFixAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
Ale_ResetDelayedAlert ();
}
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
@ -115,17 +103,19 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
if (AlertType != Ale_NONE)
{
/***** Print format and list of variables into text *****/
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Txt,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Show alert *****/
Ale_ShowFixAlert (AlertType,Txt);
/***** Free text *****/
free ((void *) Txt);
}
}
@ -133,21 +123,64 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt)
{
if (AlertType != Ale_NONE)
Ale_ShowAlertAndButton (AlertType,Txt,
ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
{
/****** Print fix alert and button ******/
Ale_ShowFixAlertAndButton1 (AlertType,Txt);
Ale_ShowAlertAndButton2 (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 Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton)
Btn_Button_t Button,const char *TxtButton,
Ale_AlertType_t AlertType,const char *fmt,...)
{
Ale_ShowAlertAndButton1 (AlertType,Txt);
va_list ap;
int NumBytesPrinted;
char *Txt;
/***** Print format and list of variables into text *****/
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Txt,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/****** Print fix alert and button ******/
Ale_ShowFixAlertAndButton1 (AlertType,Txt);
Ale_ShowAlertAndButton2 (NextAction,Anchor,OnSubmit,
FuncParams,Button,TxtButton);
/***** Free text *****/
free ((void *) Txt);
}
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Txt;
/***** Print format and list of variables into text *****/
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Txt,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/****** Print start of fix alert and button ******/
Ale_ShowFixAlertAndButton1 (AlertType,Txt);
/***** Free text *****/
free ((void *) Txt);
}
static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
{
extern const char *Txt_Close;
char IdAlert[Frm_MAX_BYTES_ID + 1];
@ -196,10 +229,9 @@ void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
if (AlertType != Ale_NONE)
fprintf (Gbl.F.Out," style=\"background-image:url('%s/%s');\"",
Gbl.Prefs.URLIcons,Ale_AlertIcons[AlertType]);
fprintf (Gbl.F.Out,">");
if (Txt)
fprintf (Gbl.F.Out,"%s",Txt);
fprintf (Gbl.F.Out,"</div>");
fprintf (Gbl.F.Out,">%s"
"</div>",
Txt);
}
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,

View File

@ -58,16 +58,15 @@ typedef enum
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void Ale_ResetAlert (void);
void Ale_ResetDelayedAlert (void);
void Ale_ShowPendingAlert (void);
void Ale_ShowDelayedAlert (void);
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...);
void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton);
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt);
Btn_Button_t Button,const char *TxtButton,
Ale_AlertType_t AlertType,const char *fmt,...);
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...);
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton);

View File

@ -25,10 +25,8 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <linux/limits.h> // For PATH_MAX
#include <linux/stddef.h> // For NULL
#include <stdio.h> // For asprintf
#include <stdlib.h> // For calloc
#include <string.h> // For string functions
@ -929,7 +927,6 @@ void Asg_ReqRemAssignment (void)
extern const char *Txt_Do_you_really_want_to_remove_the_assignment_X;
extern const char *Txt_Remove_assignment;
struct Assignment Asg;
char *Txt;
/***** Get parameters *****/
Asg_GetParamAsgOrder ();
@ -945,13 +942,10 @@ void Asg_ReqRemAssignment (void)
/***** Show question and button to remove the assignment *****/
Gbl.Asgs.AsgCodToEdit = Asg.AsgCod;
if (asprintf (&Txt,Txt_Do_you_really_want_to_remove_the_assignment_X,
Asg.Title) < 0)
Lay_NotEnoughMemoryExit ();
Ale_ShowAlertAndButton (Ale_QUESTION,Txt,
ActRemAsg,NULL,NULL,Asg_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_assignment);
free ((void *) Txt);
Ale_ShowAlertAndButton (ActRemAsg,NULL,NULL,Asg_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_assignment,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_assignment_X,
Asg.Title);
/***** Show assignments again *****/
Asg_SeeAssignments ();

View File

@ -1869,7 +1869,7 @@ void Ctr_ChangeCtrInsInConfig (void)
void Ctr_ContEditAfterChgCtrInConfig (void)
{
/***** Write error/success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Ctr_ShowConfiguration ();
@ -2122,7 +2122,7 @@ void Ctr_ChangeCtrWWW (void)
/***** Write message to show the change made
and put button to go to centre changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_new_web_address_is_X,
NewWWW);
Ctr_ShowAlertAndButtonToGoToCtr ();
@ -2212,7 +2212,7 @@ void Ctr_ChangeCtrStatus (void)
/***** Write message to show the change made
and put button to go to centre changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_status_of_the_centre_X_has_changed,
Gbl.Ctrs.EditingCtr.ShrtName);
Ctr_ShowAlertAndButtonToGoToCtr ();
@ -2253,9 +2253,9 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void)
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Go_to_X,
Gbl.Ctrs.EditingCtr.ShrtName);
Ale_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr,
Btn_CONFIRM_BUTTON,Gbl.Title);
Ale_ShowAlertAndButton (ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr,
Btn_CONFIRM_BUTTON,Gbl.Title,
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
}
else
/***** Alert *****/
@ -2361,6 +2361,7 @@ void Ctr_ReceivePhoto (void)
bool WrongType = false;
char Command[1024 + PATH_MAX * 2];
int ReturnCode;
char ErrorMsg[256];
/***** Copy in disk the file received *****/
Param = Fil_StartReceptionOfFile (Fil_NAME_OF_PARAM_FILENAME_ORG,
@ -2457,11 +2458,11 @@ void Ctr_ReceivePhoto (void)
ReturnCode = WEXITSTATUS(ReturnCode);
if (ReturnCode != 0)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Image could not be processed successfully.<br />"
"Error code returned by the program of processing: %d",
ReturnCode);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
/***** Remove temporary file *****/

View File

@ -381,8 +381,6 @@ ALTER TABLE debug ENGINE=MyISAM;
OPTIMIZE TABLE debug;
*/
// TODO: Revisar todos los Ale_ShowAlertAndButton
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -402,10 +400,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.46.12 (2019-02-16)"
#define Log_PLATFORM_VERSION "SWAD 18.47 (2019-02-17)"
#define CSS_FILE "swad18.41.1.css"
#define JS_FILE "swad18.32.1.js"
/*
Version 18.47: Feb 17, 2019 Code refactoring related to alerts. (237494 lines)
Version 18.46.12: Feb 16, 2019 Code refactoring related to error and alerts. (237627 lines)
Version 18.46.11: Feb 16, 2019 Code refactoring related to alerts. (237701 lines)
Version 18.46.10: Feb 16, 2019 Code refactoring related to alerts. (237729 lines)

View File

@ -1343,10 +1343,10 @@ void Crs_EditCourses (void)
Hie_WriteMenuHierarchy ();
/***** Start box *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Courses_of_DEGREE_X,
Gbl.CurrentDeg.Deg.ShrtName);
Box_StartBox (NULL,Gbl.Alert.Txt,Crs_PutIconsEditingCourses,
Box_StartBox (NULL,Gbl.Title,Crs_PutIconsEditingCourses,
Hlp_DEGREE_Courses,Box_NOT_CLOSABLE);
/***** Put a form to create or request a new course *****/
@ -1890,16 +1890,16 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists,
Gbl.Degs.EditingCrs.ShrtName);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists,
Gbl.Degs.EditingCrs.FullName);
}
@ -1908,15 +1908,15 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
}
else // If there is not a course name
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course,
Ale_MAX_BYTES_ALERT);
}
}
else // Year not valid
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_year_X_is_not_allowed,
Gbl.Degs.EditingCrs.Year);
}
@ -1971,8 +1971,8 @@ static void Crs_CreateCourse (unsigned Status)
Gbl.Degs.EditingCrs.FullName);
/***** Create success message *****/
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_course_X,
Gbl.Degs.EditingCrs.FullName);
}
@ -2330,14 +2330,18 @@ void Crs_ChangeInsCrsCodInConfig (void)
{
Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,NewInstitutionalCrsCod);
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
Gbl.CurrentCrs.Crs.ShrtName,NewInstitutionalCrsCod);
}
else // The same institutional code
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
{
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institutional_code_of_the_course_X_has_not_changed,
Gbl.CurrentCrs.Crs.ShrtName);
}
}
/*****************************************************************************/
@ -2366,15 +2370,15 @@ void Crs_ChangeInsCrsCod (void)
if (strcmp (NewInstitutionalCrsCod,Gbl.Degs.EditingCrs.InstitutionalCrsCod))
{
Crs_UpdateInstitutionalCrsCod (&Gbl.Degs.EditingCrs,NewInstitutionalCrsCod);
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_institutional_code_of_the_course_X_has_changed_to_Y,
Gbl.Degs.EditingCrs.ShrtName,NewInstitutionalCrsCod);
}
else // The same institutional code
{
Gbl.Alert.Type = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institutional_code_of_the_course_X_has_not_changed,
Gbl.Degs.EditingCrs.ShrtName);
}
@ -2407,8 +2411,8 @@ void Crs_ChangeCrsDegInConfig (void)
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,
Gbl.CurrentCrs.Crs.ShrtName);
@ -2416,8 +2420,8 @@ void Crs_ChangeCrsDegInConfig (void)
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,
Gbl.CurrentCrs.Crs.FullName);
@ -2433,8 +2437,8 @@ void Crs_ChangeCrsDegInConfig (void)
Hie_InitHierarchy ();
/***** Create message to show the change made *****/
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_course_X_has_been_moved_to_the_degree_Y,
Gbl.CurrentCrs.Crs.FullName,
Gbl.CurrentDeg.Deg.FullName);
@ -2449,7 +2453,7 @@ void Crs_ChangeCrsDegInConfig (void)
void Crs_ContEditAfterChgCrsInConfig (void)
{
/***** Write error/success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Crs_ShowIntroduction ();
@ -2490,16 +2494,16 @@ void Crs_ChangeCrsYearInConfig (void)
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists_in_year_Y,
Gbl.CurrentCrs.Crs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists_in_year_Y,
Gbl.CurrentCrs.Crs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
}
@ -2509,16 +2513,16 @@ void Crs_ChangeCrsYearInConfig (void)
Crs_UpdateCrsYear (&Gbl.CurrentCrs.Crs,NewYear);
/***** Create message to show the change made *****/
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_year_of_the_course_X_has_changed,
Gbl.CurrentCrs.Crs.ShrtName);
}
}
else // Year not valid
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_year_X_is_not_allowed,
NewYear);
}
@ -2559,16 +2563,16 @@ void Crs_ChangeCrsYear (void)
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
Gbl.Degs.EditingCrs.DegCod,NewYear))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists_in_year_Y,
Gbl.Degs.EditingCrs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
Gbl.Degs.EditingCrs.DegCod,NewYear))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists_in_year_Y,
Gbl.Degs.EditingCrs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
}
@ -2578,16 +2582,16 @@ void Crs_ChangeCrsYear (void)
Crs_UpdateCrsYear (&Gbl.Degs.EditingCrs,NewYear);
/***** Create message to show the change made *****/
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_year_of_the_course_X_has_changed,
Gbl.Degs.EditingCrs.ShrtName);
}
}
else // Year not valid
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_year_X_is_not_allowed,
NewYear);
}
@ -2702,8 +2706,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
/***** Check if new name is empty *****/
if (!NewCrsName[0])
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_course_X_empty,
CurrentCrsName);
}
@ -2717,8 +2721,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
if (Crs_CheckIfCrsNameExistsInYearOfDeg (ParamName,NewCrsName,Crs->CrsCod,
Crs->DegCod,Crs->Year))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_course_X_already_exists,
NewCrsName);
}
@ -2728,8 +2732,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
Crs_UpdateCrsNameDB (Crs->CrsCod,FieldName,NewCrsName);
/* Create message to show the change made */
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_name_of_the_course_X_has_changed_to_Y,
CurrentCrsName,NewCrsName);
@ -2740,8 +2744,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
}
else // The same name
{
Gbl.Alert.Type = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_course_X_has_not_changed,
CurrentCrsName);
}
@ -2814,8 +2818,8 @@ void Crs_ChangeCrsStatus (void)
Gbl.Degs.EditingCrs.Status = Status;
/***** Create message to show the change made *****/
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_course_X_has_changed,
Gbl.Degs.EditingCrs.ShrtName);
}
@ -2829,9 +2833,9 @@ void Crs_ContEditAfterChgCrs (void)
bool PutButtonToRequestRegistration;
/***** Start alert *****/
Ale_ShowAlertAndButton1 (Gbl.Alert.Type,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
if (Gbl.Alert.Type == Ale_SUCCESS)
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
{
/***** Put button to go to course changed *****/
Crs_PutButtonToGoToCrs ();

View File

@ -1159,8 +1159,8 @@ static void Deg_CreateDegree (unsigned Status)
/***** Write message to show the change made
and put button to go to degree 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_degree_X,
Gbl.Degs.EditingDeg.FullName);
Deg_ShowAlertAndButtonToGoToDeg ();
@ -1975,8 +1975,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
/***** Check if new name is empty *****/
if (!NewDegName[0])
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
CurrentDegName);
}
@ -1989,8 +1989,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
/***** If degree was in database... *****/
if (Deg_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_degree_X_already_exists,
NewDegName);
}
@ -2000,8 +2000,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
Deg_UpdateDegNameDB (Deg->DegCod,FieldName,NewDegName);
/* Write message to show the change made */
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_name_of_the_degree_X_has_changed_to_Y,
CurrentDegName,NewDegName);
@ -2012,8 +2012,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
}
else // The same name
{
Gbl.Alert.Type = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_degree_X_has_not_changed,
CurrentDegName);
}
@ -2069,15 +2069,15 @@ void Deg_ChangeDegCtrInConfig (void)
/***** Check if it already exists a degree with the same name in the new centre *****/
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.CurrentDeg.Deg.ShrtName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_degree_X_already_exists,
Gbl.CurrentDeg.Deg.ShrtName);
}
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.CurrentDeg.Deg.FullName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_degree_X_already_exists,
Gbl.CurrentDeg.Deg.FullName);
}
@ -2092,8 +2092,8 @@ void Deg_ChangeDegCtrInConfig (void)
Hie_InitHierarchy ();
/***** Create message to show the change made *****/
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_degree_X_has_been_moved_to_the_centre_Y,
Gbl.CurrentDeg.Deg.FullName,
Gbl.CurrentCtr.Ctr.FullName);
@ -2108,7 +2108,7 @@ void Deg_ChangeDegCtrInConfig (void)
void Deg_ContEditAfterChgDegInConfig (void)
{
/***** Write success / warning message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Deg_ShowConfiguration ();
@ -2156,8 +2156,8 @@ void Deg_ChangeDegWWW (void)
/***** Write message to show the change made
and put button to go to degree 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);
Deg_ShowAlertAndButtonToGoToDeg ();
@ -2247,8 +2247,8 @@ void Deg_ChangeDegStatus (void)
/***** Write message to show the change made
and put button to go to degree 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_degree_X_has_changed,
Gbl.Degs.EditingDeg.ShrtName);
Deg_ShowAlertAndButtonToGoToDeg ();
@ -2289,9 +2289,9 @@ void Deg_ShowAlertAndButtonToGoToDeg (void)
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Go_to_X,
Gbl.Degs.EditingDeg.ShrtName);
Ale_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
Btn_CONFIRM_BUTTON,Gbl.Title);
Ale_ShowAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
Btn_CONFIRM_BUTTON,Gbl.Title,
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
}
else
/***** Alert *****/

View File

@ -1022,8 +1022,8 @@ void DT_ChangeDegreeType (void)
/***** Write message to show the change made
and put button to go to degree 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_type_of_degree_of_the_degree_X_has_changed,
Gbl.Degs.EditingDeg.FullName);
Deg_ShowAlertAndButtonToGoToDeg ();

View File

@ -1865,11 +1865,9 @@ void Enr_AskRemAllStdsThisCrs (void)
{
/***** Show question and button to remove students *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_,
Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_,
Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD],
Gbl.CurrentCrs.Crs.FullName);
/* Show form to request confirmation */
Frm_StartForm (ActRemAllStdCrs);
@ -2135,12 +2133,10 @@ void Enr_AskIfRejectSignUp (void)
{
/***** Show question and button to reject user's enrolment request *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_reject_the_enrolment_request_,
Gbl.Usrs.Other.UsrDat.FullName,
Txt_ROLES_SINGUL_abc[Role][Gbl.Usrs.Other.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_reject_the_enrolment_request_,
Gbl.Usrs.Other.UsrDat.FullName,
Txt_ROLES_SINGUL_abc[Role][Gbl.Usrs.Other.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
/* Show user's record */
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -3665,10 +3661,8 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
{
/***** Show question and button to register user as administrator *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_X,
InsCtrDegName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_X,
InsCtrDegName);
/* Show user's record */
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -3727,7 +3721,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.Alert.Type = Ale_NONE; // Do not show alert
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID)) // User's ID valid
{
@ -3756,8 +3750,8 @@ void Enr_CreateNewUsr1 (void)
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
/* Success message */
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_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
Gbl.Usrs.Other.UsrDat.FullName,
Gbl.CurrentCrs.Crs.FullName,
@ -3772,8 +3766,8 @@ void Enr_CreateNewUsr1 (void)
Enr_SET_ACCEPTED_TO_FALSE);
/* Success message */
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_USER_X_has_been_enroled_in_the_course_Y,
Gbl.Usrs.Other.UsrDat.FullName,
Gbl.CurrentCrs.Crs.FullName);
@ -3808,8 +3802,8 @@ void Enr_CreateNewUsr1 (void)
else // User's ID not valid
{
/***** Error message *****/
Gbl.Alert.Type = Ale_ERROR;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_ERROR;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_is_not_valid,
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
}
@ -3817,13 +3811,13 @@ void Enr_CreateNewUsr1 (void)
void Enr_CreateNewUsr2 (void)
{
if (Gbl.Alert.Type == Ale_ERROR) // User's ID not valid
Ale_ShowPendingAlert ();
if (Gbl.DelayedAlert.Type == Ale_ERROR) // User's ID not valid
Ale_ShowDelayedAlert ();
else // User's ID valid
{
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
/***** Show optional alert *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -3844,7 +3838,7 @@ void Enr_ModifyUsr1 (void)
Rol_Role_t NewRole;
/***** Initialize alert type and message *****/
Gbl.Alert.Type = Ale_NONE; // Do not show alert
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
/***** Get user from form *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -3884,8 +3878,8 @@ void Enr_ModifyUsr1 (void)
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
/* Set success message */
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_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
Gbl.Usrs.Other.UsrDat.FullName,
Gbl.CurrentCrs.Crs.FullName,
@ -3900,8 +3894,8 @@ void Enr_ModifyUsr1 (void)
Enr_SET_ACCEPTED_TO_FALSE);
/* Set success message */
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_USER_X_has_been_enroled_in_the_course_Y,
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
}
@ -3947,56 +3941,56 @@ void Enr_ModifyUsr1 (void)
}
}
else
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_DEGREE_ADMIN:
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_CENTRE_ADMIN:
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
if (ItsMe || Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_USR_FROM_CRS:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_DEGREE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_CENTRE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
if (!Acc_CheckIfICanEliminateAccount (Gbl.Usrs.Other.UsrDat.UsrCod))
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
default:
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
break;
}
}
else
Gbl.Alert.Type = Ale_WARNING;
Gbl.DelayedAlert.Type = Ale_WARNING;
}
void Enr_ModifyUsr2 (void)
{
if (Gbl.Alert.Type == Ale_WARNING)
if (Gbl.DelayedAlert.Type == Ale_WARNING)
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
else // No error
switch (Gbl.Usrs.RegRemAction)
@ -4004,7 +3998,7 @@ void Enr_ModifyUsr2 (void)
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
/***** Show optional alert *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -4076,11 +4070,9 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
/***** Show question and button to remove user as administrator *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
ItsMe ? Txt_Do_you_really_want_to_be_removed_from_the_course_X :
Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X,
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,ItsMe ? Txt_Do_you_really_want_to_be_removed_from_the_course_X :
Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X,
Gbl.CurrentCrs.Crs.FullName);
/* Show user's record */
Rec_ShowSharedRecordUnmodifiable (UsrDat);
@ -4193,8 +4185,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
if (QuietOrVerbose == Cns_VERBOSE)
{
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_USER_X_has_been_removed_from_the_course_Y,
UsrDat->FullName,Crs->FullName);
}
@ -4202,8 +4194,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
else // User does not belong to course
if (QuietOrVerbose == Cns_VERBOSE)
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -4234,11 +4226,9 @@ static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,
{
/***** Show question and button to remove user as administrator *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
ItsMe ? Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X :
Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_X,
InsCtrDegName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,ItsMe ? Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X :
Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_X,
InsCtrDegName);
/* Show user's record */
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);

View File

@ -143,27 +143,25 @@ bool Fil_ReadStdinIntoTmpFile (void)
if (FileIsTooBig || TimeExceeded)
{
Fil_EndOfReadingStdin (); // If stdin were not fully read, there will be problems with buffers
/* Start HTTP response */
fprintf (stdout,"Content-type: text/plain; charset=windows-1252\n");
/* Status code and message */
fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n");
if (FileIsTooBig)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_UPLOAD_FILE_File_too_large_maximum_X_MiB_NO_HTML,
(unsigned long) (Fil_MAX_FILE_SIZE / (1024ULL * 1024ULL)));
fprintf (stdout,Txt_UPLOAD_FILE_File_too_large_maximum_X_MiB_NO_HTML,
(unsigned long) (Fil_MAX_FILE_SIZE / (1024ULL * 1024ULL)));
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_UPLOAD_FILE_Upload_time_too_long_maximum_X_minutes_NO_HTML,
(unsigned long) (Cfg_TIME_TO_ABORT_FILE_UPLOAD / 60UL));
fprintf (stdout,Txt_UPLOAD_FILE_Upload_time_too_long_maximum_X_minutes_NO_HTML,
(unsigned long) (Cfg_TIME_TO_ABORT_FILE_UPLOAD / 60UL));
fprintf (stdout,"\n");
/* Don't write HTML at all */
Gbl.Layout.HTMLStartWritten =
Gbl.Layout.DivsEndWritten =
Gbl.Layout.HTMLEndWritten = true;
/* Start HTTP response */
fprintf (stdout,"Content-type: text/plain; charset=windows-1252\n");
/* Status code and message */
fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n"
"%s\n",
Gbl.Alert.Txt);
return false;
}
rewind (Gbl.F.Tmp);
@ -330,6 +328,7 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
FILE **NewFile)
{
size_t LengthFileRoot = Str_GetLengthRootFileName (CurrentName);
char ErrorMsg[128 + PATH_MAX];
Str_Copy (NewName,CurrentName,
PATH_MAX);
@ -348,10 +347,10 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
/* Open the new file */
if ((*NewFile = fopen (NewName,"wb")) == NULL)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Can not create file <strong>%s</strong>.",
NewName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
}
@ -359,66 +358,33 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
/****************** Close and rename files related to an update **************/
/*****************************************************************************/
void Fil_CloseUpdateFile (const char *CurrentName,const char *OldName,const char *NewName,FILE *NewFile)
void Fil_CloseUpdateFile (const char CurrentName[PATH_MAX + 1],
const char OldName[PATH_MAX + 1],
const char NewName[PATH_MAX + 1],
FILE *NewFile)
{
char ErrorMsg[128 + 2 * PATH_MAX];
/* Close file */
fclose (NewFile);
/* Rename the old file and the new file */
if (rename (CurrentName,OldName)) // mv CurrentName OldName Ej: mv file.html file.old
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Can not rename the file <strong>%s</strong> as <strong>%s</strong>.",
CurrentName,OldName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
if (rename (NewName,CurrentName)) // mv NewName CurrentName Ej: mv file.new file.html
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Can not rename the file <strong>%s</strong> as <strong>%s</strong>.",
NewName,CurrentName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
}
/*****************************************************************************/
/*********************** Rename a file or directory **************************/
/*****************************************************************************/
bool Fil_RenameFileOrDir (const char *PathOld,const char *PathNew)
{
extern const char *Txt_There_is_already_a_non_empty_folder_named_X;
extern const char *Txt_There_is_already_a_file_named_X;
/* Rename the file or directory */
if (rename (PathOld,PathNew)) // Fail
{
switch (errno)
{
case ENOTEMPTY:
case EEXIST:
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_There_is_already_a_non_empty_folder_named_X,
PathNew);
break;
case ENOTDIR:
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_There_is_already_a_file_named_X,
PathNew);
break;
case EACCES:
Lay_ShowErrorAndExit ("Write is forbidden.");
break;
default:
Lay_ShowErrorAndExit ("Can not rename file or folder.");
break;
}
return false;
}
else // Success
return true;
}
/*****************************************************************************/
/***************** Check if existe a file or directory ***********************/
/*****************************************************************************/
@ -434,15 +400,17 @@ bool Fil_CheckIfPathExists (const char *Path)
/********** Check if a directory exists. If not exists, create it! ***********/
/*****************************************************************************/
void Fil_CreateDirIfNotExists (const char *Path)
void Fil_CreateDirIfNotExists (const char Path[PATH_MAX + 1])
{
char ErrorMsg[128 + PATH_MAX];
if (!Fil_CheckIfPathExists (Path))
if (mkdir (Path,(mode_t) 0xFFF) != 0)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Can not create folder <strong>%s</strong>.",
Path);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
}
@ -451,13 +419,14 @@ void Fil_CreateDirIfNotExists (const char *Path)
/*****************************************************************************/
// If the tree of directories and files exists, remove it
void Fil_RemoveTree (const char *Path)
void Fil_RemoveTree (const char Path[PATH_MAX + 1])
{
struct stat FileStatus;
struct dirent **FileList;
int NumFile,NumFiles;
char PathFileRel[PATH_MAX + 1];
bool Error;
char ErrorMsg[128 + PATH_MAX];
if (Fil_CheckIfPathExists (Path))
{
@ -502,10 +471,10 @@ void Fil_RemoveTree (const char *Path)
Error = true;
if (Error)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Can not remove folder %s.",
Path);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
}
}

View File

@ -71,11 +71,13 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
char OldName[PATH_MAX + 1],
char NewName[PATH_MAX + 1],
FILE **NewFile);
void Fil_CloseUpdateFile (const char *CurrentName,const char *OldName,const char *NewName,FILE *NewFile);
void Fil_CloseUpdateFile (const char CurrentName[PATH_MAX + 1],
const char OldName[PATH_MAX + 1],
const char NewName[PATH_MAX + 1],
FILE *NewFile);
bool Fil_RenameFileOrDir (const char *PathOld,const char *PathNew);
bool Fil_CheckIfPathExists (const char *Path);
void Fil_CreateDirIfNotExists (const char *Path);
void Fil_CreateDirIfNotExists (const char Path[PATH_MAX + 1]);
void Fil_RemoveTree (const char *Path);
void Fil_RemoveOldTmpFiles (const char *Path,time_t TimeToRemove,bool RemoveDirectory);

View File

@ -6713,15 +6713,13 @@ void Brw_AskRemFileFromTree (void)
Gbl.FileBrowser.FileType,
Gbl.FileBrowser.FilFolLnkName,
FileNameToShow);
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_FILE_OR_LINK_X,
FileNameToShow);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
Brw_ActRemoveFile[Gbl.FileBrowser.Type],NULL,NULL,
Ale_ShowAlertAndButton (Brw_ActRemoveFile[Gbl.FileBrowser.Type],NULL,NULL,
Brw_PutParamsRemFile,
Btn_REMOVE_BUTTON,
Gbl.FileBrowser.FileType == Brw_IS_FILE ? Txt_Remove_file :
Txt_Remove_link);
Txt_Remove_link,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_FILE_OR_LINK_X,
FileNameToShow);
}
else
Lay_ShowErrorAndExit (Txt_You_can_not_remove_this_file_or_link);
@ -6828,7 +6826,7 @@ void Brw_RemFolderFromTree (void)
if (errno == ENOTEMPTY) // The directory is not empty
{
Brw_AskConfirmRemoveFolderNotEmpty ();
Gbl.Alert.Txt[0] = '\0';
// Gbl.Alert.Txt[0] = '\0'; // TODO: Remove this line
}
else // The directory is empty
Lay_ShowErrorAndExit ("Can not remove folder.");
@ -6864,13 +6862,11 @@ static void Brw_AskConfirmRemoveFolderNotEmpty (void)
extern const char *Txt_Remove_folder;
/***** Show question and button to remove not empty folder *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_folder_X,
Gbl.FileBrowser.FilFolLnkName);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
Brw_ActRemoveFolderNotEmpty[Gbl.FileBrowser.Type],NULL,NULL,
Ale_ShowAlertAndButton (Brw_ActRemoveFolderNotEmpty[Gbl.FileBrowser.Type],NULL,NULL,
Brw_PutParamsRemFolder,
Btn_REMOVE_BUTTON,Txt_Remove_folder);
Btn_REMOVE_BUTTON,Txt_Remove_folder,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_folder_X,
Gbl.FileBrowser.FilFolLnkName);
}
/*****************************************************************************/
@ -9018,7 +9014,7 @@ void Brw_RcvFileInFileBrwDropzone (void)
else
fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n"
"%s\n",
Gbl.Alert.Txt);
Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -9031,7 +9027,7 @@ void Brw_RcvFileInFileBrwClassic (void)
Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD);
/***** Show possible alert *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show again file browser *****/
Brw_ShowAgainFileBrowserOrWorks ();
@ -9105,8 +9101,8 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
/* Check if the destination file exists */
if (Fil_CheckIfPathExists (Path))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
}
@ -9130,8 +9126,8 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
if (rename (PathTmp,Path)) // Fail
{
Fil_RemoveTree (PathTmp);
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_could_not_create_file_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
}
@ -9143,8 +9139,8 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
if (Brw_CheckIfQuotaExceded ())
{
Fil_RemoveTree (Path);
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
}
@ -9175,8 +9171,8 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
Brw_IS_FOLDER,
Gbl.FileBrowser.FilFolLnkName,
FileNameToShow);
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_file_X_has_been_placed_inside_the_folder_Y,
Gbl.FileBrowser.NewFilFolLnkName,
FileNameToShow);
@ -9224,15 +9220,15 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
}
else // Empty filename
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML,
Ale_MAX_BYTES_ALERT);
}
}
else // I do not have permission to create files here
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_UPLOAD_FILE_Forbidden_NO_HTML,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_UPLOAD_FILE_Forbidden_NO_HTML,
Ale_MAX_BYTES_ALERT);
}
@ -9433,7 +9429,7 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
/* Check file extension */
if (!Str_FileIsHTML (Gbl.FileBrowser.NewFilFolLnkName))
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_not_HTML_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
return false;
@ -9446,7 +9442,7 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
if (strcmp (MIMEType,"application/octetstream"))
if (strcmp (MIMEType,"application/octet"))
{ // MIME type forbidden
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
return false;
@ -9456,7 +9452,7 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
/* Check file extension */
if (!Ext_CheckIfFileExtensionIsAllowed (Gbl.FileBrowser.NewFilFolLnkName))
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_extension_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
return false;
@ -9465,7 +9461,7 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
/* Check MIME type*/
if (!MIM_CheckIfMIMETypeIsAllowed (MIMEType))
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
return false;

View File

@ -1033,12 +1033,12 @@ void Fol_FollowUsr1 (void)
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0));
}
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Type = Ale_SUCCESS;
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -1047,17 +1047,17 @@ void Fol_FollowUsr2 (void)
{
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
if (Gbl.Alert.Type == Ale_SUCCESS)
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
/***** Show user's profile again *****/
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
if (Gbl.Alert.Type != Ale_SUCCESS)
Ale_ShowPendingAlert ();
if (Gbl.DelayedAlert.Type != Ale_SUCCESS)
Ale_ShowDelayedAlert ();
}
/*****************************************************************************/
@ -1080,12 +1080,12 @@ void Fol_UnfollowUsr1 (void)
" WHERE FollowerCod=%ld AND FollowedCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Other.UsrDat.UsrCod);
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Type = Ale_SUCCESS;
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -1093,7 +1093,7 @@ void Fol_UnfollowUsr1 (void)
void Fol_UnfollowUsr2 (void)
{
/***** Get user to be unfollowed *****/
if (Gbl.Alert.Type == Ale_SUCCESS)
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
{
/***** Show user's profile again *****/
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile
@ -1103,7 +1103,7 @@ void Fol_UnfollowUsr2 (void)
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow
}
else
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
}
/*****************************************************************************/

View File

@ -4237,17 +4237,18 @@ void For_RequestRemoveThread (void)
/***** Show question and button to remove the thread *****/
Lay_StartSection (For_REMOVE_THREAD_SECTION_ID);
if (Subject[0])
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_entire_thread_X,
Subject);
Ale_ShowAlertAndButton (For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type],
For_FORUM_THREADS_SECTION_ID,NULL,
For_PutAllHiddenParamsRemThread,
Btn_REMOVE_BUTTON,Txt_Remove_thread,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_entire_thread_X,
Subject);
else
Str_Copy (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread,
Ale_MAX_BYTES_ALERT);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type],
For_FORUM_THREADS_SECTION_ID,NULL,
For_PutAllHiddenParamsRemThread,
Btn_REMOVE_BUTTON,Txt_Remove_thread);
Ale_ShowAlertAndButton (For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type],
For_FORUM_THREADS_SECTION_ID,NULL,
For_PutAllHiddenParamsRemThread,
Btn_REMOVE_BUTTON,Txt_Remove_thread,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_entire_thread);
Lay_EndSection ();
/***** Show the threads again *****/
@ -4294,10 +4295,10 @@ void For_RemoveThread (void)
/***** Show the threads again *****/
if (Subject[0])
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Thread_X_removed,Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4332,10 +4333,10 @@ void For_CutThread (void)
/***** Show the threads again *****/
if (Subject[0])
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Thread_X_marked_to_be_moved,Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4370,11 +4371,11 @@ void For_PasteThread (void)
/***** Show the threads again *****/
if (Subject[0])
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_thread_X_is_already_in_this_forum,
Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_WARNING,Gbl.Alert.Txt);
Ale_WARNING,Gbl.DelayedAlert.Txt);
}
else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4391,11 +4392,11 @@ void For_PasteThread (void)
/***** Show the threads again *****/
if (Subject[0])
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Thread_X_moved_to_this_forum,
Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,

View File

@ -1501,12 +1501,10 @@ void Gam_AskRemGame (void)
/***** Show question and button to remove game *****/
Gbl.Games.CurrentGamCod = Game.GamCod;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_game_X,
Game.Title);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemGam,NULL,NULL,Gam_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_game);
Ale_ShowAlertAndButton (ActRemGam,NULL,NULL,Gam_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_game,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_game_X,
Game.Title);
/***** Show games again *****/
Gam_ListAllGames ();
@ -3238,12 +3236,10 @@ void Gam_RequestRemoveQst (void)
/***** Show question and button to remove question *****/
Gbl.Games.CurrentGamCod = Game.GamCod;
Gbl.Games.CurrentQstCod = QstCod;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) (QstInd + 1));
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemGamQst,NULL,NULL,Gam_PutParamsOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question);
Ale_ShowAlertAndButton (ActRemGamQst,NULL,NULL,Gam_PutParamsOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) (QstInd + 1));
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,

View File

@ -124,7 +124,7 @@ void Gbl_InitializeGlobals (void)
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
Ale_ResetAlert ();
Ale_ResetDelayedAlert ();
Gbl.DB.DatabaseIsOpen = false;
Gbl.DB.LockedTables = false;

View File

@ -110,13 +110,7 @@ struct Globals
Ale_AlertType_t Type;
char Txt[Ale_MAX_BYTES_ALERT + 1];
const char *Section; // Where to display the alert
} Alert; // TODO: Obsolete -> change progressively
struct
{
Ale_AlertType_t Type;
char Txt[Ale_MAX_BYTES_ALERT + 1];
const char *Section; // Where to display the alert
} DelayedAlert; // Used in a posteriori function to write success / warning message
} DelayedAlert; // Alert message created in a function and printed in a subsequent function.
struct
{
size_t ContentLength;

View File

@ -672,22 +672,22 @@ void Grp_ChangeMyGrps (Cns_QuietOrVerbose_t QuietOrVerbose)
{
if (ChangesMade)
{
Gbl.Alert.Type = Ale_SUCCESS;
Str_Copy (Gbl.Alert.Txt,Txt_The_requested_group_changes_were_successful,
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_requested_group_changes_were_successful,
Ale_MAX_BYTES_ALERT);
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_There_has_been_no_change_in_groups,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_has_been_no_change_in_groups,
Ale_MAX_BYTES_ALERT);
}
}
}
else if (QuietOrVerbose == Cns_VERBOSE)
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group,
Ale_MAX_BYTES_ALERT);
}
@ -3806,7 +3806,7 @@ void Grp_RecFormNewGrpTyp (void)
if (Grp_CheckIfGroupTypeNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,-1L))
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_group_X_already_exists,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
}
@ -3815,7 +3815,7 @@ void Grp_RecFormNewGrpTyp (void)
Grp_CreateGroupType ();
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Created_new_type_of_group_X,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
}
@ -3823,12 +3823,12 @@ void Grp_RecFormNewGrpTyp (void)
else // If there is not a group type name
{
AlertType = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_type_of_group,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_type_of_group,
Ale_MAX_BYTES_ALERT);
}
/***** Show the form again *****/
Grp_ReqEditGroupsInternal (AlertType,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -3880,7 +3880,7 @@ void Grp_RecFormNewGrp (void)
if (Grp_CheckIfGroupNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,Gbl.CurrentCrs.Grps.GrpName,-1L))
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_already_exists,
Gbl.CurrentCrs.Grps.GrpName);
}
@ -3890,7 +3890,7 @@ void Grp_RecFormNewGrp (void)
/* Write success message */
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Created_new_group_X,
Gbl.CurrentCrs.Grps.GrpName);
}
@ -3898,20 +3898,20 @@ void Grp_RecFormNewGrp (void)
else // If there is not a group name
{
AlertType = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_group,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_group,
Ale_MAX_BYTES_ALERT);
}
}
else // Invalid group type
{
AlertType = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Wrong type of group.",
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong type of group.",
Ale_MAX_BYTES_ALERT);
}
/***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.Alert.Txt);
AlertType,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4036,17 +4036,17 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps)
/***** Show question and button to remove type of group *****/
if (NumGrps == 1)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
Ale_ShowAlertAndButton (ActRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID,NULL,
Grp_PutParamRemGrpTyp,
Btn_REMOVE_BUTTON,Txt_Remove_type_of_group,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NumGrps);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID,NULL,
Grp_PutParamRemGrpTyp,
Btn_REMOVE_BUTTON,Txt_Remove_type_of_group);
Ale_ShowAlertAndButton (ActRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID,NULL,
Grp_PutParamRemGrpTyp,
Btn_REMOVE_BUTTON,Txt_Remove_type_of_group,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NumGrps);
/***** Show the form to edit group types and groups again *****/
Grp_ReqEditGroupsInternal1 (Ale_INFO,NULL);
@ -4088,21 +4088,23 @@ static void Grp_AskConfirmRemGrp (void)
/***** Show question and button to remove group *****/
if (NumStds == 0)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_group_X,
GrpDat.GrpName);
Ale_ShowAlertAndButton (ActRemGrp,Grp_GROUPS_SECTION_ID,NULL,
Grp_PutParamRemGrp,
Btn_REMOVE_BUTTON,Txt_Remove_group,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_group_X,
GrpDat.GrpName);
else if (NumStds == 1)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_group_X_1_student_,
GrpDat.GrpName);
Ale_ShowAlertAndButton (ActRemGrp,Grp_GROUPS_SECTION_ID,NULL,
Grp_PutParamRemGrp,
Btn_REMOVE_BUTTON,Txt_Remove_group,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_group_X_1_student_,
GrpDat.GrpName);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_group_X_Y_students_,
GrpDat.GrpName,NumStds);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemGrp,Grp_GROUPS_SECTION_ID,NULL,
Grp_PutParamRemGrp,
Btn_REMOVE_BUTTON,Txt_Remove_group);
Ale_ShowAlertAndButton (ActRemGrp,Grp_GROUPS_SECTION_ID,NULL,
Grp_PutParamRemGrp,
Btn_REMOVE_BUTTON,Txt_Remove_group,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_group_X_Y_students_,
GrpDat.GrpName,NumStds);
/***** Show the form to edit groups again *****/
Grp_ReqEditGroupsInternal2 (Ale_INFO,NULL);
@ -4192,12 +4194,12 @@ static void Grp_RemoveGroupTypeCompletely (void)
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Type_of_group_X_removed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
/***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -4242,13 +4244,13 @@ static void Grp_RemoveGroupCompletely (void)
Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Group_X_removed,
GrpDat.GrpName);
/***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4274,14 +4276,14 @@ void Grp_OpenGroup (void)
Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_is_now_open,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.Open = true;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4307,14 +4309,14 @@ void Grp_CloseGroup (void)
Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_is_now_closed,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.Open = false;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4340,14 +4342,14 @@ void Grp_EnableFileZonesGrp (void)
Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_File_zones_of_the_group_X_are_now_enabled,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.FileZones = true;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4373,14 +4375,14 @@ void Grp_DisableFileZonesGrp (void)
Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_File_zones_of_the_group_X_are_now_disabled,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.FileZones = false;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.Alert.Txt);
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4412,7 +4414,7 @@ void Grp_ChangeGroupType (void)
{
/* Create warning message */
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_already_exists,
GrpDat.GrpName);
}
@ -4425,7 +4427,7 @@ void Grp_ChangeGroupType (void)
/* Create message to show the change made */
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_group_of_the_group_X_has_changed,
GrpDat.GrpName);
}
@ -4433,7 +4435,7 @@ void Grp_ChangeGroupType (void)
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.Alert.Txt);
AlertType,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4466,14 +4468,14 @@ void Grp_ChangeGroupClassroom (void)
/* Create message to show the change made */
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_classroom_assigned_to_the_group_X_has_changed,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.ClaCod = NewClaCod;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.Alert.Txt);
AlertType,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4504,7 +4506,7 @@ void Grp_ChangeMandatGrpTyp (void)
if (Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment)
{
AlertType = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
}
@ -4519,7 +4521,7 @@ void Grp_ChangeMandatGrpTyp (void)
/***** Write message to show the change made *****/
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
NewMandatoryEnrolment ? Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_mandatory :
Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
@ -4527,7 +4529,7 @@ void Grp_ChangeMandatGrpTyp (void)
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment;
Grp_ReqEditGroupsInternal (AlertType,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -4559,7 +4561,7 @@ void Grp_ChangeMultiGrpTyp (void)
if (Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment)
{
AlertType = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
}
@ -4575,7 +4577,7 @@ void Grp_ChangeMultiGrpTyp (void)
/***** Write message to show the change made *****/
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
NewMultipleEnrolment ? Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X :
Txt_Now_each_student_can_only_belong_to_a_group_of_type_X,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
@ -4583,7 +4585,7 @@ void Grp_ChangeMultiGrpTyp (void)
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment;
Grp_ReqEditGroupsInternal (AlertType,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -4621,7 +4623,7 @@ void Grp_ChangeOpenTimeGrpTyp (void)
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
/***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -4659,7 +4661,7 @@ void Grp_ChangeMaxStdsGrp (void)
if (GrpDat.MaxStudents == NewMaxStds)
{
AlertType = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_maximum_number_of_students_in_group_X_has_not_changed,
GrpDat.GrpName);
}
@ -4674,11 +4676,11 @@ void Grp_ChangeMaxStdsGrp (void)
/***** Write message to show the change made *****/
AlertType = Ale_SUCCESS;
if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_does_not_have_a_student_limit_now,
GrpDat.GrpName);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_maximum_number_of_students_in_group_X_is_now_Y,
GrpDat.GrpName,NewMaxStds);
}
@ -4686,7 +4688,7 @@ void Grp_ChangeMaxStdsGrp (void)
/***** Show the form again *****/
Gbl.CurrentCrs.Grps.MaxStudents = NewMaxStds;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.Alert.Txt);
AlertType,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/
@ -4742,7 +4744,7 @@ void Grp_RenameGroupType (void)
if (!NewNameGrpTyp[0])
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_type_of_group_X_empty,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
}
@ -4756,7 +4758,7 @@ void Grp_RenameGroupType (void)
if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod))
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_group_X_already_exists,
NewNameGrpTyp);
}
@ -4771,7 +4773,7 @@ void Grp_RenameGroupType (void)
/***** Write message to show the change made *****/
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_type_of_group_X_has_been_renamed_as_Y,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp);
}
@ -4779,7 +4781,7 @@ void Grp_RenameGroupType (void)
else // The same name
{
AlertType = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_type_of_group_X_has_not_changed,
NewNameGrpTyp);
}
@ -4788,7 +4790,7 @@ void Grp_RenameGroupType (void)
/***** Show the form again *****/
Str_Copy (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp,
Grp_MAX_BYTES_GROUP_TYPE_NAME);
Grp_ReqEditGroupsInternal (AlertType,Gbl.Alert.Txt,
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
Ale_INFO,NULL);
}
@ -4822,7 +4824,7 @@ void Grp_RenameGroup (void)
if (!NewNameGrp[0])
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_group_X_empty,
GrpDat.GrpName);
}
@ -4836,7 +4838,7 @@ void Grp_RenameGroup (void)
if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod))
{
AlertType = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_already_exists,
NewNameGrp);
}
@ -4849,7 +4851,7 @@ void Grp_RenameGroup (void)
/***** Write message to show the change made *****/
AlertType = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_group_X_has_been_renamed_as_Y,
GrpDat.GrpName,NewNameGrp);
}
@ -4857,7 +4859,7 @@ void Grp_RenameGroup (void)
else // The same name
{
AlertType = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_group_X_has_not_changed,
NewNameGrp);
}
@ -4867,7 +4869,7 @@ void Grp_RenameGroup (void)
Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp,
Grp_MAX_BYTES_GROUP_NAME);
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.Alert.Txt);
AlertType,Gbl.DelayedAlert.Txt);
}
/*****************************************************************************/

View File

@ -683,17 +683,16 @@ void Hld_RemoveHoliday1 (void)
Hld.HldCod);
/***** Write message to show the change made *****/
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_Holiday_X_removed,
Hld.Name);
}
void Hld_RemoveHoliday2 (void)
{
/***** Show success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();
@ -734,8 +733,8 @@ void Hld_ChangeHolidayPlace1 (void)
Plc_MAX_BYTES_PLACE_FULL_NAME);
/***** Write message to show the change made *****/
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_place_of_the_holiday_X_has_changed_to_Y,
Hld->Name,NewPlace.FullName);
}
@ -743,7 +742,7 @@ void Hld_ChangeHolidayPlace1 (void)
void Hld_ChangeHolidayPlace2 (void)
{
/***** Show success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();
@ -778,8 +777,8 @@ void Hld_ChangeHolidayType1 (void)
(unsigned) Hld->HldTyp,Hld->HldCod);
/***** Write message to show the change made *****/
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_type_of_the_holiday_X_has_changed,
Hld->Name);
}
@ -787,7 +786,7 @@ void Hld_ChangeHolidayType1 (void)
void Hld_ChangeHolidayType2 (void)
{
/***** Show success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();
@ -877,9 +876,9 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
Dat_AssignDate (PtrDate,&NewDate);
/***** Write message to show the change made *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Dat_ConvDateToDateStr (&NewDate,StrDate);
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_date_of_the_holiday_X_has_changed_to_Y,
Hld->Name,StrDate);
}
@ -891,7 +890,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
void Hld_ChangeDate2 (void)
{
/***** Show success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();
@ -925,8 +924,8 @@ void Hld_RenameHoliday1 (void)
/***** Check if new name is empty *****/
if (!NewHldName[0])
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_holiday_X_empty,
Hld->Name);
}
@ -945,15 +944,15 @@ void Hld_RenameHoliday1 (void)
Hld_MAX_BYTES_HOLIDAY_NAME);
/***** Write message to show the change made *****/
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_name_of_the_holiday_X_has_changed_to_Y,
Hld->Name,NewHldName);
}
else // The same name
{
Gbl.Alert.Type = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_holiday_X_has_not_changed,
Hld->Name);
}
@ -963,7 +962,7 @@ void Hld_RenameHoliday1 (void)
void Hld_RenameHoliday2 (void)
{
/***** Write error/success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();
@ -1184,16 +1183,16 @@ void Hld_RecFormNewHoliday1 (void)
Hld_CreateHoliday (Hld);
/* Success message */
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_holiday_X,
Hld->Name);
}
else // If there is not a holiday name
{
/* Error message */
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_holiday,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_holiday,
Ale_MAX_BYTES_ALERT);
}
}
@ -1201,7 +1200,7 @@ void Hld_RecFormNewHoliday1 (void)
void Hld_RecFormNewHoliday2 (void)
{
/***** Write error/success message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Hld_EditHolidays ();

View File

@ -487,6 +487,7 @@ static void Img_ProcessImage (struct Image *Image,
{
char Command[1024 + PATH_MAX * 2];
int ReturnCode;
char ErrorMsg[256];
snprintf (Command,sizeof (Command),
"convert %s -resize '%ux%u>' -quality %u %s",
@ -503,11 +504,11 @@ static void Img_ProcessImage (struct Image *Image,
ReturnCode = WEXITSTATUS(ReturnCode);
if (ReturnCode != 0)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorMsg,sizeof (ErrorMsg),
"Image could not be processed successfully.<br />"
"Error code returned by the program of processing: %d",
ReturnCode);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorMsg);
}
}

View File

@ -560,13 +560,11 @@ static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss)
extern const char *Txt_Show_anyway;
/***** Show alert and button to confirm that I want to see the big list *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_The_list_of_X_courses_is_too_large_to_be_displayed,
NumCrss);
Ale_ShowAlertAndButton (Ale_WARNING,Gbl.Alert.Txt,
Gbl.Action.Act,NULL,NULL,
Ale_ShowAlertAndButton (Gbl.Action.Act,NULL,NULL,
Ind_PutParamsConfirmIWantToSeeBigList,
Btn_CONFIRM_BUTTON,Txt_Show_anyway);
Btn_CONFIRM_BUTTON,Txt_Show_anyway,
Ale_WARNING,Txt_The_list_of_X_courses_is_too_large_to_be_displayed,
NumCrss);
}
static void Ind_PutParamsConfirmIWantToSeeBigList (void)

View File

@ -1840,8 +1840,8 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
/***** Check if new name is empty *****/
if (!NewInsName[0])
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
CurrentInsName);
}
@ -1854,8 +1854,8 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
/***** If institution was in database... *****/
if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,Gbl.CurrentCty.Cty.CtyCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institution_X_already_exists,
NewInsName);
}
@ -1865,8 +1865,8 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
Ins_UpdateInsNameDB (Ins->InsCod,FieldName,NewInsName);
/* Create message to show the change made */
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_institution_X_has_been_renamed_as_Y,
CurrentInsName,NewInsName);
@ -1877,8 +1877,8 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
}
else // The same name
{
Gbl.Alert.Type = Ale_INFO;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_name_of_the_institution_X_has_not_changed,
CurrentInsName);
}
@ -1937,15 +1937,15 @@ void Ins_ChangeInsCtyInConfig (void)
/***** Check if it already exists an institution with the same name in the new country *****/
if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.CurrentIns.Ins.ShrtName,-1L,NewCty.CtyCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.ShrtName);
}
else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.CurrentIns.Ins.FullName,-1L,NewCty.CtyCod))
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.FullName);
}
@ -1960,8 +1960,8 @@ void Ins_ChangeInsCtyInConfig (void)
Hie_InitHierarchy ();
/***** Write message to show the change made *****/
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_country_of_the_institution_X_has_changed_to_Y,
Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
}
@ -1975,7 +1975,7 @@ void Ins_ChangeInsCtyInConfig (void)
void Ins_ContEditAfterChgInsInConfig (void)
{
/***** Write success / warning message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show the form again *****/
Ins_ShowConfiguration ();
@ -2150,15 +2150,10 @@ static void Ins_ShowAlertAndButtonToGoToIns (void)
// If the institution beeing edited is different to the current one...
if (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod)
{
/***** Alert with button to go to degree *****/
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Go_to_X,
Gbl.Inss.EditingIns.ShrtName);
Ale_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
Btn_CONFIRM_BUTTON,Gbl.Title);
}
Ale_ShowAlertAndButton (ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
Btn_CONFIRM_BUTTON,Gbl.Title,
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
else
/***** Alert *****/
Ale_ShowDelayedAlert ();

View File

@ -150,12 +150,11 @@ void Lan_AskChangeLanguage (void)
Gbl.Prefs.Language = Lan_GetParamLanguage (); // Change temporarily language to set form action
/***** Request confirmation *****/
Ale_ShowAlertAndButton (Ale_QUESTION,
Gbl.Usrs.Me.Logged ? Txt_Do_you_want_to_change_your_language_to_LANGUAGE[Gbl.Prefs.Language] :
Txt_Do_you_want_to_change_the_language_to_LANGUAGE[Gbl.Prefs.Language],
ActChgLan,NULL,NULL,Lan_PutParamLanguage,
Ale_ShowAlertAndButton (ActChgLan,NULL,NULL,Lan_PutParamLanguage,
Btn_CONFIRM_BUTTON,
Txt_Switch_to_LANGUAGE[Gbl.Prefs.Language]);
Txt_Switch_to_LANGUAGE[Gbl.Prefs.Language],
Ale_QUESTION,Gbl.Usrs.Me.Logged ? Txt_Do_you_want_to_change_your_language_to_LANGUAGE[Gbl.Prefs.Language] :
Txt_Do_you_want_to_change_the_language_to_LANGUAGE[Gbl.Prefs.Language]);
Gbl.Prefs.Language = CurrentLanguage; // Restore current language

View File

@ -630,9 +630,9 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
/***** Check if new name is empty *****/
if (!NewMaiName[0])
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_email_domain_X_empty,
CurrentMaiName);
}
@ -645,9 +645,9 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
/***** If mail was in database... *****/
if (Mai_CheckIfMailDomainNameExists (ParamName,NewMaiName,Mai->MaiCod))
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_domain_X_already_exists,
NewMaiName);
}
@ -657,18 +657,18 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
Mai_UpdateMailDomainNameDB (Mai->MaiCod,FieldName,NewMaiName);
/* Write message to show the change made */
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_domain_X_has_been_renamed_as_Y,
CurrentMaiName,NewMaiName);
}
}
else // The same name
{
Gbl.Alert.Type = Ale_INFO;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_INFO;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_domain_X_has_not_changed,
CurrentMaiName);
}
@ -1218,7 +1218,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
Act_Action_t NextAction;
/***** Show possible alert *****/
if (Gbl.Alert.Section == (const char *) Mai_EMAIL_SECTION_ID)
if (Gbl.DelayedAlert.Section == (const char *) Mai_EMAIL_SECTION_ID)
Ale_ShowDelayedAlert ();
/***** Help message *****/
@ -1453,9 +1453,9 @@ static void Mai_RemoveEmail (struct UsrData *UsrDat)
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
/***** Show message *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Email_X_removed,
Email);
@ -1544,9 +1544,9 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
if (UsrDat->EmailConfirmed &&
!strcmp (UsrDat->Email,NewEmail)) // User's current confirmed email match exactly the new email
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_X_matches_one_previously_registered,
NewEmail);
}
@ -1555,9 +1555,9 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
if (Mai_UpdateEmailInDB (UsrDat,NewEmail))
{
/***** Email updated sucessfully *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_X_has_been_registered_successfully,
NewEmail);
@ -1571,9 +1571,9 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_X_had_been_registered_by_another_user,
NewEmail);
}
@ -1581,18 +1581,18 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
}
else // New email is not valid
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_entered_X_is_not_valid,
NewEmail);
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
}
@ -1700,22 +1700,22 @@ bool Mai_SendMailMsgToConfirmEmail (void)
{
case 0: // Message sent successfully
Gbl.Usrs.Me.ConfirmEmailJustSent = true;
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address,
Gbl.Usrs.Me.UsrDat.Email);
return true;
case 1:
Gbl.Alert.Type = Ale_ERROR;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_There_was_a_problem_sending_an_email_automatically,
Gbl.DelayedAlert.Type = Ale_ERROR;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_was_a_problem_sending_an_email_automatically,
Ale_MAX_BYTES_ALERT);
return false;
default:
Gbl.Alert.Type = Ale_ERROR;
Gbl.Alert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_ERROR;
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
"Internal error: an email message has not been sent successfully."
" Error code returned by the script: %d",
ReturnCode);

View File

@ -326,8 +326,8 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
// Only one table is allowed
if (Str_FindStrInFile (FileAllMarks,"<table",Str_NO_SKIP_HTML_COMMENTS))
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_There_are_more_than_one_table_in_the_file_of_marks,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_are_more_than_one_table_in_the_file_of_marks,
Ale_MAX_BYTES_ALERT);
FileIsCorrect = false;
}
@ -389,8 +389,8 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_Table_not_found_in_the_file_of_marks,
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Table_not_found_in_the_file_of_marks,
Ale_MAX_BYTES_ALERT);
FileIsCorrect = false;
}
@ -874,28 +874,28 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
{
fclose (FileUsrMarks);
if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.Alert.Txt) < 0)
Gbl.DelayedAlert.Txt) < 0)
Lay_NotEnoughMemoryExit ();
}
}
else
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Can not open file of marks.",
Ale_MAX_BYTES_ALERT);
if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.Alert.Txt) < 0)
Gbl.DelayedAlert.Txt) < 0)
Lay_NotEnoughMemoryExit ();
}
unlink (FileNameUsrMarks); // File with marks is no longer necessary
}
else
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"User's IDs not found!",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"User's IDs not found!",
Ale_MAX_BYTES_ALERT);
if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.Alert.Txt) < 0)
Gbl.DelayedAlert.Txt) < 0)
Lay_NotEnoughMemoryExit ();
}
}

View File

@ -862,34 +862,29 @@ void Msg_ReqDelAllRecMsgs (void)
if (Gbl.Msg.FilterContent[0])
{
if (Gbl.Msg.ShowOnlyUnreadMsgs)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_the_unread_messages_received_from_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_the_unread_messages_received_from_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_all_messages_received_from_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_all_messages_received_from_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
}
else
{
if (Gbl.Msg.ShowOnlyUnreadMsgs)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_the_unread_messages_received_from_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_the_unread_messages_received_from_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_all_messages_received_from_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_all_messages_received_from_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
}
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
/* Show received messages again */
Gbl.Msg.TypeOfMessages = Msg_MESSAGES_RECEIVED;
@ -920,18 +915,15 @@ void Msg_ReqDelAllSntMsgs (void)
/***** Show question and button to remove messages received *****/
/* Start alert */
if (Gbl.Msg.FilterContent[0])
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_all_messages_sent_to_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_all_messages_sent_to_USER_X_from_COURSE_Y_related_to_CONTENT_Z,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName,Gbl.Msg.FilterContent);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_delete_all_messages_sent_to_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_delete_all_messages_sent_to_USER_X_from_COURSE_Y,
Gbl.Msg.FilterFromTo[0] ? Gbl.Msg.FilterFromTo :
Txt_any_user,
Gbl.Msg.FilterCrsShrtName);
/* Show sent messages again */
Gbl.Msg.TypeOfMessages = Msg_MESSAGES_SENT;

View File

@ -253,7 +253,7 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show possible alert *****/
if (Gbl.Alert.Section == (const char *) Nck_NICKNAME_SECTION_ID)
if (Gbl.DelayedAlert.Section == (const char *) Nck_NICKNAME_SECTION_ID)
Ale_ShowDelayedAlert ();
/***** Help message *****/
@ -436,17 +436,17 @@ void Nck_RemoveMyNick (void)
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NicknameWithoutArroba);
/***** Show message *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Nickname_X_removed,
NicknameWithoutArroba);
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_You_can_not_delete_your_current_nickname,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_your_current_nickname,
Ale_MAX_BYTES_ALERT);
}
@ -476,9 +476,9 @@ void Nck_RemoveOtherUsrNick (void)
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NicknameWithoutArroba);
/***** Show message *****/
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_Nickname_X_removed,
NicknameWithoutArroba);
@ -568,9 +568,9 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
/***** Check if new nickname exists in database *****/
if (!strcmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname match exactly the new nickname
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
NewNicknameWithoutArroba);
}
@ -587,14 +587,14 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
" WHERE Nickname='%s' AND UsrCod<>%ld",
NewNicknameWithoutArroba,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_X_had_been_registered_by_another_user,
NewNicknameWithoutArroba);
}
}
if (Gbl.Alert.Type == Ale_NONE)
if (Gbl.DelayedAlert.Type == Ale_NONE)
{
// Now we know the new nickname is not already in database
// and is diffent to the current one
@ -602,18 +602,18 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
Str_Copy (UsrDat->Nickname,NewNicknameWithoutArroba,
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_X_has_been_registered_successfully,
NewNicknameWithoutArroba);
}
}
else // New nickname is not valid
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_entered_X_is_not_valid_,
NewNicknameWithArroba,
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,

View File

@ -493,6 +493,7 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
bool ParamFound = false;
unsigned ParamNameLength;
bool FindMoreThanOneOcurrence;
char ErrorTxt[256];
/***** Default values returned *****/
if (ParamValue)
@ -557,11 +558,11 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
/* Check if there is space to copy separator */
if (BytesAlreadyCopied + 1 > MaxBytes)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Multiple parameter <strong>%s</strong> too large,"
" it exceed the maximum allowed size (%lu bytes).",
ParamName,(unsigned long) MaxBytes);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/* Copy separator */
@ -576,11 +577,11 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
/* Check if there is space to copy the parameter value */
if (BytesAlreadyCopied + Param->Value.Length > MaxBytes)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Parameter <strong>%s</strong> too large,"
" it exceed the maximum allowed size (%lu bytes).",
ParamName,(unsigned long) MaxBytes);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/* Copy parameter value */

View File

@ -179,9 +179,9 @@ void Pwd_UpdateMyPwd (void)
Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Me.UsrDat);
else
{
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_You_have_not_entered_your_password_correctly,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_entered_your_password_correctly,
Ale_MAX_BYTES_ALERT);
}
}
@ -223,9 +223,9 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat)
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
{
// Passwords don't match
Gbl.Alert.Type = Ale_WARNING;
Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_You_have_not_written_twice_the_same_new_password,
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_written_twice_the_same_new_password,
Ale_MAX_BYTES_ALERT);
}
else
@ -241,9 +241,9 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat)
Ses_UpdateSessionDataInDB ();
Enr_UpdateUsrData (UsrDat);
Gbl.Alert.Type = Ale_SUCCESS;
Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.Alert.Txt,Txt_The_password_has_been_changed_successfully,
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_has_been_changed_successfully,
Ale_MAX_BYTES_ALERT);
}
}
@ -321,6 +321,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
unsigned NumUsr;
char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
int ReturnCode;
char ErrorTxt[256];
/***** Check if user's ID or nickname is not empty *****/
if (!Gbl.Usrs.Me.UsrIdLogin[0])
@ -396,11 +397,11 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
Lay_ShowErrorAndExit (Txt_There_was_a_problem_sending_an_email_automatically);
break;
default:
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Internal error: an email message has not been sent successfully."
" Error code returned by the script: %d",
ReturnCode);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
break;
}
}
@ -622,7 +623,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
{
Gbl.DelayedAlert.Type = Ale_WARNING;
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_password_must_be_at_least_X_characters,
Pwd_MIN_CHARS_PLAIN_PASSWORD);
return false;
@ -688,7 +689,7 @@ void Pwd_ShowFormChgMyPwd (void)
Hlp_PROFILE_Password,Box_NOT_CLOSABLE);
/***** Show possible alert *****/
if (Gbl.Alert.Section == Pwd_PASSWORD_SECTION_ID)
if (Gbl.DelayedAlert.Section == Pwd_PASSWORD_SECTION_ID)
Ale_ShowDelayedAlert ();
/***** Help message *****/
@ -852,7 +853,7 @@ void Pwd_ShowFormChgOtherUsrPwd (void)
Lay_StartSection (Pwd_PASSWORD_SECTION_ID);
/***** Show possible alert *****/
if (Gbl.Alert.Section == (const char *) Pwd_PASSWORD_SECTION_ID)
if (Gbl.DelayedAlert.Section == (const char *) Pwd_PASSWORD_SECTION_ID)
Ale_ShowDelayedAlert ();
/***** Form to change password *****/

View File

@ -465,7 +465,7 @@ void Pho_RemoveMyPhoto1 (void)
void Pho_RemoveMyPhoto2 (void)
{
/***** Write success / warning message *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Show my record and other data *****/
Rec_ShowMySharedRecordAndMore ();
@ -497,10 +497,8 @@ void Pho_ReqRemoveUsrPhoto (void)
{
/***** Show question and button to remove user's photo *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_photo_of_X,
Gbl.Usrs.Other.UsrDat.FullName);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_photo_of_X,
Gbl.Usrs.Other.UsrDat.FullName);
/* Show current photo */
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL,
@ -551,7 +549,7 @@ void Pho_RemoveUsrPhoto (void)
{
/***** Remove photo *****/
if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat))
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
}
else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
@ -601,6 +599,7 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
unsigned BackgroundCode;
char StrFileName[NAME_MAX + 1];
Act_Action_t NextAction;
char ErrorTxt[256];
/***** Creates directories if not exist *****/
snprintf (PathPhotosPriv,sizeof (PathPhotosPriv),
@ -730,69 +729,43 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
NumFacesTotal = NumFacesGreen = NumFacesRed = 0;
break;
default: // Error
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Photo could not be processed successfully.<br />"
"Error code returned by the program of processing: %d",
ReturnCode);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
break;
}
/***** Message to the user about the number of faces detected in the image*****/
/***** Start alert to the user about the number of faces detected in the image*****/
if (NumFacesTotal == 0)
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_Could_not_detect_any_face_in_front_position_,
Ale_MAX_BYTES_ALERT);
}
Ale_ShowAlertAndButton1 (Ale_WARNING,Txt_Could_not_detect_any_face_in_front_position_);
else if (NumFacesTotal == 1)
{
if (NumFacesGreen == 1)
{
Gbl.Alert.Type = Ale_SUCCESS;
Str_Copy (Gbl.Alert.Txt,Txt_A_face_marked_in_green_has_been_detected_,
Ale_MAX_BYTES_ALERT);
}
Ale_ShowAlertAndButton1 (Ale_SUCCESS,Txt_A_face_marked_in_green_has_been_detected_);
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_A_face_marked_in_red_has_been_detected_,
Ale_MAX_BYTES_ALERT);
}
Ale_ShowAlertAndButton1 (Ale_WARNING,Txt_A_face_marked_in_red_has_been_detected_);
}
else // NumFacesTotal > 1
{
if (NumFacesRed == 0)
{
Gbl.Alert.Type = Ale_SUCCESS;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_X_faces_marked_in_green_have_been_detected_,
NumFacesGreen);
}
Ale_ShowAlertAndButton1 (Ale_SUCCESS,Txt_X_faces_marked_in_green_have_been_detected_,
NumFacesGreen);
else if (NumFacesGreen == 0)
{
Gbl.Alert.Type = Ale_WARNING;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_X_faces_marked_in_red_have_been_detected_,
NumFacesRed);
}
Ale_ShowAlertAndButton1 (Ale_WARNING,Txt_X_faces_marked_in_red_have_been_detected_,
NumFacesRed);
else // NumFacesGreen > 0
{
Gbl.Alert.Type = Ale_SUCCESS;
if (NumFacesGreen == 1)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_X_faces_have_been_detected_in_front_position_1_Z_,
NumFacesTotal,NumFacesRed);
Ale_ShowAlertAndButton1 (Ale_SUCCESS,Txt_X_faces_have_been_detected_in_front_position_1_Z_,
NumFacesTotal,NumFacesRed);
else
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_X_faces_have_been_detected_in_front_position_Y_Z_,
NumFacesTotal,NumFacesGreen,NumFacesRed);
Ale_ShowAlertAndButton1 (Ale_SUCCESS,Txt_X_faces_have_been_detected_in_front_position_Y_Z_,
NumFacesTotal,NumFacesGreen,NumFacesRed);
}
}
/***** Start alert *****/
Ale_ShowAlertAndButton1 (Gbl.Alert.Type,Gbl.Alert.Txt);
/***** Create map *****/
fprintf (Gbl.F.Out,"<map name=\"faces_map\">\n");
if (NumFacesTotal)
@ -914,14 +887,14 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat)
/* Remove the user from the list of users without photo */
Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod);
Gbl.Alert.Type = Ale_SUCCESS;
Str_Copy (Gbl.Alert.Txt,Txt_Photo_has_been_updated,
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_has_been_updated,
Ale_MAX_BYTES_ALERT);
}
else
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Error updating photo.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Error updating photo.",
Ale_MAX_BYTES_ALERT);
}
}
@ -932,7 +905,7 @@ static void Pho_UpdatePhoto2 (void)
unsigned NumPhoto;
/***** Start alert *****/
Ale_ShowAlertAndButton1 (Gbl.Alert.Type,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
/***** Show the three images resulting of the processing *****/
Tbl_StartTableWide (0);
@ -1154,15 +1127,15 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
if (NumErrors)
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Error removing photo.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Error removing photo.",
Ale_MAX_BYTES_ALERT);
return false;
}
else
{
Gbl.Alert.Type = Ale_SUCCESS;
Str_Copy (Gbl.Alert.Txt,Txt_Photo_removed,
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_removed,
Ale_MAX_BYTES_ALERT);
return true;
}

View File

@ -2033,12 +2033,10 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
/***** Show question and button to remove user as administrator *****/
/* Start alert */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
ItsMe ? Txt_Do_you_really_want_to_be_removed_as_a_X_from_the_project_Y :
Txt_Do_you_really_want_to_remove_the_following_user_as_a_X_from_the_project_Y,
Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject],
Prj.Title);
Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_QUESTION,ItsMe ? Txt_Do_you_really_want_to_be_removed_as_a_X_from_the_project_Y :
Txt_Do_you_really_want_to_remove_the_following_user_as_a_X_from_the_project_Y,
Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject],
Prj.Title);
/* Show user's record */
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -2677,12 +2675,10 @@ void Prj_ReqRemProject (void)
{
/***** Show question and button to remove the project *****/
Gbl.Prjs.PrjCod = Prj.PrjCod;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_project_X,
Prj.Title);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemPrj,NULL,NULL,Prj_PutCurrentParams,
Btn_REMOVE_BUTTON,Txt_Remove_project);
Ale_ShowAlertAndButton (ActRemPrj,NULL,NULL,Prj_PutCurrentParams,
Btn_REMOVE_BUTTON,Txt_Remove_project,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_project_X,
Prj.Title);
}
else
Lay_NoPermissionExit ();

View File

@ -583,10 +583,8 @@ void Rec_CreateRecordField (void)
(unsigned) Gbl.CurrentCrs.Records.Field.Visibility);
/***** Write message of success *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Created_new_record_field_X,
Gbl.CurrentCrs.Records.Field.Name);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_record_field_X,
Gbl.CurrentCrs.Records.Field.Name);
}
/*****************************************************************************/
@ -639,11 +637,8 @@ unsigned Rec_CountNumRecordsInCurrCrsWithField (long FieldCod)
void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
{
extern const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X;
extern const char *Txt_this_field_is_filled_in_the_record_of_one_student;
extern const char *Txt_this_field_is_filled_in_the_records_of_X_students;
extern const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_;
extern const char *Txt_Remove_record_field;
char Message_part2[512];
/***** Get from the database the name of the field *****/
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,
@ -652,23 +647,11 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
&Gbl.CurrentCrs.Records.Field.Visibility);
/***** Show question and button to remove my photo *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X,
Gbl.CurrentCrs.Records.Field.Name,Gbl.CurrentCrs.Crs.FullName);
if (NumRecords == 1)
Str_Concat (Gbl.Alert.Txt,Txt_this_field_is_filled_in_the_record_of_one_student,
Ale_MAX_BYTES_ALERT);
else
{
snprintf (Message_part2,sizeof (Message_part2),
Txt_this_field_is_filled_in_the_records_of_X_students,
NumRecords);
Str_Concat (Gbl.Alert.Txt,Message_part2,
Ale_MAX_BYTES_ALERT);
}
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemFie,NULL,NULL,Rec_PutParamFielCod,
Btn_REMOVE_BUTTON,Txt_Remove_record_field);
Ale_ShowAlertAndButton (ActRemFie,NULL,NULL,Rec_PutParamFielCod,
Btn_REMOVE_BUTTON,Txt_Remove_record_field,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_,
Gbl.CurrentCrs.Records.Field.Name,Gbl.CurrentCrs.Crs.FullName,
NumRecords);
/***** List record fields again *****/
Rec_ReqEditRecordFields ();
@ -1048,7 +1031,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
/* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1116,7 +1099,7 @@ static void Rec_ShowRecordOneStdCrs (void)
fprintf (Gbl.F.Out,"</div>");
/***** Show optional alert (result of editing data in course record) *****/
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/***** Start container for this user *****/
fprintf (Gbl.F.Out,"<div class=\"REC_USR\">");
@ -1255,7 +1238,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1481,7 +1464,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
/* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowPendingAlert ();
Ale_ShowDelayedAlert ();
/* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1645,8 +1628,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
extern const char *Txt_Student_record_card_in_this_course_has_been_updated;
long OriginalActCod;
/***** Initialize alert type and message *****/
Gbl.Alert.Type = Ale_NONE; // Do not show alert
/***** Initialize alert type *****/
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
/***** Get where we came from *****/
OriginalActCod = Par_GetParToLong ("OriginalActCod");
@ -1667,8 +1650,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
/***** Update the record *****/
Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod);
Gbl.Alert.Type = Ale_SUCCESS;
Str_Copy (Gbl.Alert.Txt,Txt_Student_record_card_in_this_course_has_been_updated,
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Student_record_card_in_this_course_has_been_updated,
Ale_MAX_BYTES_ALERT);
/***** Show one or multiple records *****/

View File

@ -419,6 +419,7 @@ unsigned Ses_GetHiddenParFromDB (Act_Action_t NextAction,
bool ParameterIsTooBig = false;
unsigned NumTimes = 0;
const char *Ptr;
char ErrorTxt[256];
ParamValue[0] = '\0';
if (Gbl.Session.IsOpen) // If the session is open, get parameter from DB
@ -452,11 +453,11 @@ unsigned Ses_GetHiddenParFromDB (Act_Action_t NextAction,
if (ParameterIsTooBig)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Hidden parameter <strong>%s</strong> too large,"
" it exceed the maximum allowed size (%lu bytes).",
ParamName,(unsigned long) MaxBytes);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/***** Count number of values of the parameter *****/

View File

@ -2892,15 +2892,16 @@ void Str_CreateRandomAlphanumStr (char *Str,size_t Length)
void Str_Copy (char *Dst,const char *Src,size_t DstSize)
{
char ErrorTxt[128];
size_t LengthSrc = strlen (Src);
/***** Check if buffer has enough space for source *****/
if (LengthSrc > DstSize)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Trying to copy %lu chars into a %lu-chars buffer.",
LengthSrc,DstSize);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/***** Copy source into destination *****/
@ -2917,15 +2918,16 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
size_t LengthDst;
size_t LengthSrc;
size_t FreeSpace;
char ErrorTxt[256];
/***** Check if buffer has already overflowed *****/
LengthDst = strlen (Dst);
if (LengthDst > DstSize)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"%lu-chars buffer has %lu chars!",
DstSize,LengthDst);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/***** Check if buffer has enough space for source *****/
@ -2934,10 +2936,11 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
LengthSrc = strlen (Src);
if (FreeSpace < LengthSrc)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
"Trying to concatenate %lu chars to a %lu-chars buffer with free space for only %lu chars!",
snprintf (ErrorTxt,sizeof (ErrorTxt),
"Trying to concatenate %lu chars to a %lu-chars buffer"
" with free space for only %lu chars!",
LengthSrc,DstSize,FreeSpace);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
/***** Concatenate ******/

View File

@ -1516,12 +1516,10 @@ void Svy_AskRemSurvey (void)
/***** Show question and button to remove survey *****/
Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_survey_X,
Svy.Title);
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemSvy,NULL,NULL,Svy_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_survey);
Ale_ShowAlertAndButton (ActRemSvy,NULL,NULL,Svy_PutParams,
Btn_REMOVE_BUTTON,Txt_Remove_survey,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_survey_X,
Svy.Title);
/***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst);
@ -2650,7 +2648,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
if (NumAnswers > Svy_MAX_ANSWERS_PER_QUESTION)
Lay_ShowErrorAndExit ("Wrong answer.");
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
Svy_MAX_BYTES_ANSWER);
@ -2888,7 +2886,8 @@ static bool Svy_AllocateTextChoiceAnswer (struct SurveyQuestion *SvyQst,
Svy_FreeTextChoiceAnswer (SvyQst,NumAns);
if ((SvyQst->AnsChoice[NumAns].Text = (char *) malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL)
{
Str_Copy (Gbl.Alert.Txt,"Not enough memory to store answer.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.",
Ale_MAX_BYTES_ALERT);
return false;
}
@ -2969,7 +2968,7 @@ void Svy_ReceiveQst (void)
NumAns++)
{
if (!Svy_AllocateTextChoiceAnswer (&SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
snprintf (AnsStr,sizeof (AnsStr),
"AnsStr%u",
NumAns);
@ -3400,7 +3399,7 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
/* Convert the answer (row[2]), that is in HTML, to rigorous HTML */
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
Svy_MAX_BYTES_ANSWER);
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
@ -3553,12 +3552,10 @@ void Svy_RequestRemoveQst (void)
/***** Show question and button to remove question *****/
Gbl.Svys.SvyCodToEdit = SvyCod;
Gbl.Svys.SvyQstCodToEdit = SvyQst.QstCod;
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) (SvyQst.QstInd + 1));
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemSvyQst,NULL,NULL,Svy_PutParamsRemoveOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question);
Ale_ShowAlertAndButton (ActRemSvyQst,NULL,NULL,Svy_PutParamsRemoveOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) (SvyQst.QstInd + 1));
/***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true);

View File

@ -3734,7 +3734,7 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
/***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
/***** Assign index (row[0]).
Index is 0,1,2,3... if no shuffle
@ -3853,7 +3853,7 @@ static void Tst_WriteChoiceAnsAssessTest (struct UsrData *UsrDat,
/***** Allocate memory for text in this choice option *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
/***** Copy answer text (row[1]) and convert it,
that is in HTML, to rigorous HTML ******/
@ -4101,7 +4101,7 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
/***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
/***** Assign index (row[0]).
Index is 0,1,2,3... if no shuffle
@ -4213,7 +4213,7 @@ static void Tst_WriteTextAnsAssessTest (struct UsrData *UsrDat,
/***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
/***** Copy answer text (row[1]) and convert it, that is in HTML, to rigorous HTML ******/
Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1],
@ -5446,14 +5446,16 @@ int Tst_AllocateTextChoiceAnswer (unsigned NumOpt)
if ((Gbl.Test.Answer.Options[NumOpt].Text =
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{
Str_Copy (Gbl.Alert.Txt,"Not enough memory to store answer.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.",
Ale_MAX_BYTES_ALERT);
return 0;
}
if ((Gbl.Test.Answer.Options[NumOpt].Feedback =
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{
Str_Copy (Gbl.Alert.Txt,"Not enough memory to store feedback.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store feedback.",
Ale_MAX_BYTES_ALERT);
return 0;
}
@ -5643,7 +5645,7 @@ static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
if (Gbl.Test.Answer.NumOptions > Tst_MAX_OPTIONS_PER_QUESTION)
Lay_ShowErrorAndExit ("Wrong answer.");
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
@ -5851,18 +5853,18 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
{
case Tst_ANS_INT:
if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Par_GetParToText ("AnsInt",Gbl.Test.Answer.Options[0].Text,1 + 10);
break;
case Tst_ANS_FLOAT:
if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Par_GetParToText ("AnsFloatMin",Gbl.Test.Answer.Options[0].Text,
Tst_MAX_BYTES_FLOAT_ANSWER);
if (!Tst_AllocateTextChoiceAnswer (1))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text,
Tst_MAX_BYTES_FLOAT_ANSWER);
break;
@ -5883,7 +5885,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
NumOpt++)
{
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
/* Get answer */
snprintf (AnsStr,sizeof (AnsStr),
@ -6261,30 +6263,30 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
" WHERE CrsCod=%ld AND TagTxt='%s'",
Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
Gbl.Alert.Type = Ale_NONE;
Gbl.DelayedAlert.Type = Ale_NONE;
if (NumRows == 1)
{
/***** Get tag code *****/
row = mysql_fetch_row (mysql_res);
if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Wrong code of tag.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong code of tag.",
Ale_MAX_BYTES_ALERT);
}
}
else if (NumRows > 1)
{
Gbl.Alert.Type = Ale_ERROR;
Str_Copy (Gbl.Alert.Txt,"Duplicated tag.",
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Duplicated tag.",
Ale_MAX_BYTES_ALERT);
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
if (Gbl.Alert.Type == Ale_ERROR)
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
if (Gbl.DelayedAlert.Type == Ale_ERROR)
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
return TagCod;
}
@ -6355,28 +6357,21 @@ void Tst_RequestRemoveQst (void)
Lay_ShowErrorAndExit ("Wrong test parameters.");
/***** Show question and button to remove question *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) Gbl.Test.QstCod);
if (EditingOnlyThisQst)
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemTstQst,NULL,NULL,
Tst_PutParamsRemoveOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question);
else
{
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemTstQst,NULL,NULL,
Tst_PutParamsRemoveQst,
Btn_REMOVE_BUTTON,Txt_Remove_question);
Tst_FreeTagsList ();
}
Ale_ShowAlertAndButton (ActRemTstQst,NULL,NULL,
EditingOnlyThisQst ? Tst_PutParamsRemoveOneQst :
Tst_PutParamsRemoveQst,
Btn_REMOVE_BUTTON,Txt_Remove_question,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) Gbl.Test.QstCod);
/***** Continue editing questions *****/
if (EditingOnlyThisQst)
Tst_ListOneQstToEdit ();
else
{
Tst_FreeTagsList ();
Tst_ListQuestionsToEdit ();
}
}
/*****************************************************************************/

View File

@ -826,7 +826,7 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
{
case Tst_ANS_INT:
if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
if (AnswerElem->Content)
Str_Copy (Gbl.Test.Answer.Options[0].Text,AnswerElem->Content,
@ -834,9 +834,9 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
break;
case Tst_ANS_FLOAT:
if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
if (!Tst_AllocateTextChoiceAnswer (1))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
for (LowerUpperElem = AnswerElem->FirstChild;
LowerUpperElem != NULL;
@ -888,7 +888,7 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
if (!strcmp (OptionElem->TagName,"option"))
{
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
for (TextElem = OptionElem->FirstChild;
TextElem != NULL;

View File

@ -8557,34 +8557,43 @@ const char *Txt_Do_you_really_want_to_remove_the_event_X = // Warning: it is ver
"Voc&ecirc; realmente deseja remover o evento <strong>%s</strong>?";
#endif
const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X = // Warning: it is very important to include two %s in the following sentences
const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_ = // Warning: it is very important to include two %s and one %u in the following sentences
#if L==1 // ca
"&iquest;Realmente desea eliminar el campo <strong>%s</strong>"
" de las fichas de <strong>%s</strong>?"; // Necessita traduccio
" de las fichas de <strong>%s</strong>"
" (dicho campo est&aacute; relleno en las fichas de %u estudiante(s))?"; // Necessita traduccio
#elif L==2 // de
"Do you really want to remove the field <strong>%s</strong>"
" from the records of <strong>%s</strong>?"; // Need Übersetzung
" from the records of <strong>%s</strong>"
" (this field is filled in the records of %u student(s))?"; // Need Übersetzung
#elif L==3 // en
"Do you really want to remove the field <strong>%s</strong>"
" from the records of <strong>%s</strong>?";
" from the records of <strong>%s</strong>"
" (this field is filled in the records of %u student(s))?";
#elif L==4 // es
"&iquest;Realmente desea eliminar el campo <strong>%s</strong>"
" de las fichas de <strong>%s</strong>?";
" de las fichas de <strong>%s</strong>"
" (dicho campo est&aacute; relleno en las fichas de %u estudiante(s))?";
#elif L==5 // fr
"Do you really want to remove the field <strong>%s</strong>"
" from the records of <strong>%s</strong>?"; // Besoin de traduction
" from the records of <strong>%s</strong>"
" (this field is filled in the records of %u student(s))?"; // Besoin de traduction
#elif L==6 // gn
"&iquest;Realmente desea eliminar el campo <strong>%s</strong>"
" de las fichas de <strong>%s</strong>?"; // Okoteve traducción
" de las fichas de <strong>%s</strong>"
" (dicho campo est&aacute; relleno en las fichas de %u estudiante(s))?"; // Okoteve traducción
#elif L==7 // it
"Vuoi realmente rimuovere il campo <strong>%s</strong>"
" dalle schede di <strong>%s</strong>?";
" dalle schede di <strong>%s</strong>"
" (questo campo &egrave; inserito nella scheda di %u studenti)?";
#elif L==8 // pl
"Czy na pewno chcesz usunac pole <strong>%s</strong>"
" z ewidencji <strong>%s</strong>?";
"Do you really want to remove the field <strong>%s</strong>"
" from the records of <strong>%s</strong>"
" (this field is filled in the records of %u student(s))?"; // Potrzebujesz tlumaczenie
#elif L==9 // pt
"Voc&ecirc; realmente quer remover o campo <strong>%s</strong>"
" dos cart&otilde;es de <strong>%s</strong>?";
" dos cart&otilde;es de <strong>%s</strong>"
" (este campo &eacute; preenchido nos cart&otilde;es de %u estudante(s))?";
#endif
const char *Txt_Do_you_really_want_to_remove_FILE_OR_LINK_X = // Warning: it is very important to include %s in the following sentences
@ -48721,48 +48730,6 @@ const char *Txt_There_was_an_error_in_assessing_the_test_X = // Warning: it is v
"Houve um erro ao avaliar o teste %u.";
#endif
const char *Txt_this_field_is_filled_in_the_record_of_one_student =
#if L==1 // ca
" (dicho campo est&aacute; relleno en la ficha de un estudiante)"; // Necessita traduccio
#elif L==2 // de
" (this field is filled in the record of one student)"; // Need Übersetzung
#elif L==3 // en
" (this field is filled in the record of one student)";
#elif L==4 // es
" (dicho campo est&aacute; relleno en la ficha de un estudiante)";
#elif L==5 // fr
" (this field is filled in the record of one student)"; // Besoin de traduction
#elif L==6 // gn
" (dicho campo est&aacute; relleno en la ficha de un estudiante)"; // Okoteve traducción
#elif L==7 // it
" (questo campo &egrave; inserito nella scheda di uno studente)";
#elif L==8 // pl
" (this field is filled in the record of one student)"; // Potrzebujesz tlumaczenie
#elif L==9 // pt
" (este campo &eacute; preenchido no cart&atilde;o de um estudante)";
#endif
const char *Txt_this_field_is_filled_in_the_records_of_X_students = // Warning: it is very important to include %u in the following sentences
#if L==1 // ca
" (dicho campo est&aacute; relleno en las fichas de %u estudiantes)"; // Necessita traduccio
#elif L==2 // de
" (this field is filled in the records of %u students)"; // Need Übersetzung
#elif L==3 // en
" (this field is filled in the records of %u students)";
#elif L==4 // es
" (dicho campo est&aacute; relleno en las fichas de %u estudiantes)";
#elif L==5 // fr
" (this field is filled in the records of %u students)"; // Besoin de traduction
#elif L==6 // gn
" (dicho campo est&aacute; relleno en las fichas de %u estudiantes)"; // Okoteve traducción
#elif L==7 // it
" (questo campo &egrave; inserito nella scheda di %u studenti)";
#elif L==8 // pl
" (this field is filled in the records of %u students)"; // Potrzebujesz tlumaczenie
#elif L==9 // pt
" (este campo &eacute; preenchido nos cart&otilde;es de %u estudantes)";
#endif
const char *Txt_This_game_has_no_questions =
#if L==1 // ca
"Aquest joc no t&eacute; preguntes.";

View File

@ -263,21 +263,16 @@ void Usr_InformAboutNumClicksBeforePhoto (void)
extern const char *Txt_You_must_send_your_photo_because_;
extern const char *Txt_You_can_only_perform_X_further_actions_;
extern const char *Txt_Upload_photo;
char Message[512]; // Don't use Gbl.Alert.Txt here, because it may be filled with another message and such message would be overwritten
if (Gbl.Usrs.Me.NumAccWithoutPhoto)
{
if (Gbl.Usrs.Me.NumAccWithoutPhoto >= Pho_MAX_CLICKS_WITHOUT_PHOTO)
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),
Txt_You_can_only_perform_X_further_actions_,
Pho_MAX_CLICKS_WITHOUT_PHOTO - Gbl.Usrs.Me.NumAccWithoutPhoto);
Ale_ShowAlertAndButton (Ale_WARNING,Message,
ActReqMyPho,NULL,NULL,NULL,
Btn_CONFIRM_BUTTON,Txt_Upload_photo);
}
Ale_ShowAlertAndButton (ActReqMyPho,NULL,NULL,NULL,
Btn_CONFIRM_BUTTON,Txt_Upload_photo,
Ale_WARNING,Txt_You_can_only_perform_X_further_actions_,
Pho_MAX_CLICKS_WITHOUT_PHOTO - Gbl.Usrs.Me.NumAccWithoutPhoto);
}
}
@ -2533,20 +2528,15 @@ void Usr_WelcomeUsr (void)
{
/* Mark my birthday as already congratulated */
Usr_InsertMyBirthday ();
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Happy_birthday_X,
Gbl.Usrs.Me.UsrDat.FirstName);
/* Start alert */
Ale_ShowAlertAndButton1 (Ale_INFO,Gbl.Alert.Txt);
Ale_ShowAlertAndButton1 (Ale_INFO,Txt_Happy_birthday_X,
Gbl.Usrs.Me.UsrDat.FirstName);
/* Show cake icon */
fprintf (Gbl.F.Out,"<img src=\"%s/birthday-cake.svg\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO160x160\" />",
Gbl.Prefs.URLIconSet,
Gbl.Alert.Txt,
Gbl.Alert.Txt);
" alt=\"\" class=\"ICO160x160\" />",
Gbl.Prefs.URLIconSet);
/* End alert */
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
@ -2555,9 +2545,9 @@ void Usr_WelcomeUsr (void)
/***** Alert with button to check email address *****/
if ( Gbl.Usrs.Me.UsrDat.Email[0] &&
!Gbl.Usrs.Me.UsrDat.EmailConfirmed) // Email needs to be confirmed
Ale_ShowAlertAndButton (Ale_WARNING,Txt_Please_check_your_email_address,
ActFrmMyAcc,NULL,NULL,NULL,
Btn_CONFIRM_BUTTON,Txt_Check);
Ale_ShowAlertAndButton (ActFrmMyAcc,NULL,NULL,NULL,
Btn_CONFIRM_BUTTON,Txt_Check,
Ale_WARNING,Txt_Please_check_your_email_address);
}
/***** Institutional video *****/
@ -2937,7 +2927,7 @@ void Usr_ChkUsrAndGetUsrData (void)
/* Send message via email to confirm the new email address */
Mai_SendMailMsgToConfirmEmail ();
Ale_ShowPendingAlert (); // Show alert after sending email confirmation
Ale_ShowDelayedAlert (); // Show alert after sending email confirmation
}
}
else // Gbl.Action.Act != ActCreUsrAcc
@ -5497,13 +5487,11 @@ static void Usr_PutButtonToConfirmIWantToSeeBigList (unsigned NumUsrs,const char
extern const char *Txt_Show_anyway;
/***** Show alert and button to confirm that I want to see the big list *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_The_list_of_X_users_is_too_large_to_be_displayed,
NumUsrs);
Ale_ShowAlertAndButton (Ale_WARNING,Gbl.Alert.Txt,
Gbl.Action.Act,Usr_USER_LIST_SECTION_ID,OnSubmit,
Ale_ShowAlertAndButton (Gbl.Action.Act,Usr_USER_LIST_SECTION_ID,OnSubmit,
Usr_PutParamsConfirmIWantToSeeBigList,
Btn_CONFIRM_BUTTON,Txt_Show_anyway);
Btn_CONFIRM_BUTTON,Txt_Show_anyway,
Ale_WARNING,Txt_The_list_of_X_users_is_too_large_to_be_displayed,
NumUsrs);
}
static void Usr_PutParamsConfirmIWantToSeeBigList (void)
@ -8489,18 +8477,18 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
Role == Rol_STD && // No students found
Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
/***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_STD],
ActReqEnrSevStd,NULL,NULL,NULL,
Btn_CREATE_BUTTON,Txt_Register_students);
Ale_ShowAlertAndButton (ActReqEnrSevStd,NULL,NULL,NULL,
Btn_CREATE_BUTTON,Txt_Register_students,
Ale_WARNING,Txt_No_users_found[Rol_STD]);
else if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected
Role == Rol_TCH && // No teachers found
Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am an administrator
/***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_TCH],
ActReqMdfOneTch,NULL,NULL,NULL,
Btn_CREATE_BUTTON,Txt_Register_teacher);
Ale_ShowAlertAndButton (ActReqMdfOneTch,NULL,NULL,NULL,
Btn_CREATE_BUTTON,Txt_Register_teacher,
Ale_WARNING,Txt_No_users_found[Rol_TCH]);
else
/***** Show alert *****/
Ale_ShowAlert (Ale_INFO,Txt_No_users_found[Role]);

View File

@ -118,6 +118,7 @@ static void XML_GetElement (struct XMLElement *ParentElem)
size_t ContentLength;
size_t EndTagNameLength;
size_t TagLength;
char ErrorTxt[128];
/*
<parent...> element content </parent>
@ -151,17 +152,17 @@ static void XML_GetElement (struct XMLElement *ParentElem)
EndTagNameLength = strcspn (Gbl.XMLPtr,">");
if (ParentElem->TagNameLength != EndTagNameLength)
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"XML syntax error. Expect end tag &lt;/%s&gt;.",
ParentElem->TagName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
if (strncmp (ParentElem->TagName,Gbl.XMLPtr,EndTagNameLength)) // XML tags are case sensitive
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
snprintf (ErrorTxt,sizeof (ErrorTxt),
"XML syntax error. Expect end tag &lt;/%s&gt;.",
ParentElem->TagName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
// End of parent element found!
@ -288,6 +289,7 @@ static void XML_GetAttributes (struct XMLElement *Elem)
{
struct XMLAttribute *Attribute;
bool EndOfStartTag = false;
char ErrorTxt[256];
/*
<parent><child attribute1="value" attribute2="value">...</child>...</parent>
@ -364,10 +366,11 @@ static void XML_GetAttributes (struct XMLElement *Elem)
}
else
{
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
"XML syntax error after attribute &quot;%s&quot; inside element &quot;%s&quot;.",
snprintf (ErrorTxt,sizeof (ErrorTxt),
"XML syntax error after attribute &quot;%s&quot;"
" inside element &quot;%s&quot;.",
Attribute->AttributeName,Elem->TagName);
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
Lay_ShowErrorAndExit (ErrorTxt);
}
if ((Attribute->Content = (char *) malloc (Attribute->ContentLength + 1)) == NULL)