Version18.69

This commit is contained in:
Antonio Cañas Vargas 2019-03-09 20:12:44 +01:00
parent 0b9bd947ac
commit 9ac17c016a
37 changed files with 1305 additions and 1438 deletions

127
swad_ID.c
View File

@ -588,9 +588,8 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
unsigned NumID; unsigned NumID;
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Show possible alert *****/ /***** Show possible alerts *****/
if (Gbl.DelayedAlert.Section == (const char *) ID_ID_SECTION_ID) Ale_ShowAlerts (ID_ID_SECTION_ID);
Ale_ShowDelayedAlert ();
/***** Help message *****/ /***** Help message *****/
if (IShouldFillInID) if (IShouldFillInID)
@ -764,10 +763,10 @@ void ID_RemoveOtherUsrID (void)
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -778,7 +777,6 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
{ {
extern const char *Txt_ID_X_removed; extern const char *Txt_ID_X_removed;
extern const char *Txt_You_can_not_delete_this_ID; extern const char *Txt_You_can_not_delete_this_ID;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char UsrID[ID_MAX_BYTES_USR_ID + 1]; char UsrID[ID_MAX_BYTES_USR_ID + 1];
bool ICanRemove; bool ICanRemove;
@ -804,27 +802,16 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
ID_RemoveUsrIDFromDB (UsrDat->UsrCod,UsrID); ID_RemoveUsrIDFromDB (UsrDat->UsrCod,UsrID);
/***** Show message *****/ /***** Show message *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; Txt_ID_X_removed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), UsrID);
Txt_ID_X_removed,
UsrID);
} }
else else
{ Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_delete_this_ID);
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_this_ID,
Ale_MAX_BYTES_ALERT);
}
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -876,7 +863,6 @@ void ID_NewMyUsrID (void)
void ID_NewOtherUsrID (void) void ID_NewOtherUsrID (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe; bool ItsMe;
/***** Get other user's code from form and get user's data *****/ /***** Get other user's code from form and get user's data *****/
@ -895,10 +881,10 @@ void ID_NewOtherUsrID (void)
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -912,7 +898,6 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
extern const char *Txt_A_user_can_not_have_more_than_X_IDs; extern const char *Txt_A_user_can_not_have_more_than_X_IDs;
extern const char *Txt_The_ID_X_has_been_registered_successfully; extern const char *Txt_The_ID_X_has_been_registered_successfully;
extern const char *Txt_The_ID_X_is_not_valid; extern const char *Txt_The_ID_X_is_not_valid;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char NewID[ID_MAX_BYTES_USR_ID + 1]; char NewID[ID_MAX_BYTES_USR_ID + 1];
unsigned NumID; unsigned NumID;
bool AlreadyExists; bool AlreadyExists;
@ -941,33 +926,23 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
if (AlreadyExists) // This new ID was already associated to this user if (AlreadyExists) // This new ID was already associated to this user
{ {
if (ItsMe || UsrDat->IDs.List[NumIDFound].Confirmed) if (ItsMe || UsrDat->IDs.List[NumIDFound].Confirmed)
{ Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_ID_X_matches_one_of_the_existing,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; NewID);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_matches_one_of_the_existing,
NewID);
}
else // It's not me && !Confirmed else // It's not me && !Confirmed
{ {
/***** Mark this ID as confirmed *****/ /***** Mark this ID as confirmed *****/
ID_ConfirmUsrID (UsrDat,NewID); ID_ConfirmUsrID (UsrDat,NewID);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; Txt_The_ID_X_has_been_confirmed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewID);
Txt_The_ID_X_has_been_confirmed,
NewID);
} }
} }
else if (UsrDat->IDs.Num >= ID_MAX_IDS_PER_USER) else if (UsrDat->IDs.Num >= ID_MAX_IDS_PER_USER)
{ Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_A_user_can_not_have_more_than_X_IDs,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; ID_MAX_IDS_PER_USER);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_A_user_can_not_have_more_than_X_IDs,
ID_MAX_IDS_PER_USER);
}
else // OK ==> add this new ID to my list of IDs else // OK ==> add this new ID to my list of IDs
{ {
/***** Save this new ID *****/ /***** Save this new ID *****/
@ -975,29 +950,18 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
// Not me ==> ID confirmed // Not me ==> ID confirmed
ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe); ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; Txt_The_ID_X_has_been_registered_successfully,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewID);
Txt_The_ID_X_has_been_registered_successfully,
NewID);
} }
} }
else // New ID is not valid else // New ID is not valid
{ Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_ID_X_is_not_valid,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; NewID);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_ID_X_is_not_valid,
NewID);
}
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1025,7 +989,6 @@ void ID_ConfirmOtherUsrID (void)
{ {
extern const char *Txt_ID_X_had_already_been_confirmed; extern const char *Txt_ID_X_had_already_been_confirmed;
extern const char *Txt_The_ID_X_has_been_confirmed; extern const char *Txt_The_ID_X_has_been_confirmed;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
long OriginalActCod; long OriginalActCod;
char UsrID[ID_MAX_BYTES_USR_ID + 1]; char UsrID[ID_MAX_BYTES_USR_ID + 1];
bool ICanConfirm; bool ICanConfirm;
@ -1068,14 +1031,10 @@ void ID_ConfirmOtherUsrID (void)
if (Found) // Found if (Found) // Found
{ {
if (Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed) if (Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed)
{
/***** ID found and already confirmed *****/ /***** ID found and already confirmed *****/
Gbl.DelayedAlert.Type = Ale_INFO; Ale_CreateAlert (Ale_INFO,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; Txt_ID_X_had_already_been_confirmed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
Txt_ID_X_had_already_been_confirmed,
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
}
else else
{ {
/***** Mark this ID as confirmed *****/ /***** Mark this ID as confirmed *****/
@ -1084,28 +1043,16 @@ void ID_ConfirmOtherUsrID (void)
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed = true; Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed = true;
/***** Write success message *****/ /***** Write success message *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID; Txt_The_ID_X_has_been_confirmed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
Txt_The_ID_X_has_been_confirmed,
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
} }
} }
else // User's ID not found else // User's ID not found
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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 else // I can not confirm
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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);
}
/***** Show one or multiple records *****/ /***** Show one or multiple records *****/
switch (Gbl.Action.Original) switch (Gbl.Action.Original)
@ -1124,7 +1071,7 @@ void ID_ConfirmOtherUsrID (void)
break; break;
default: default:
/* Show optional alert */ /* Show optional alert */
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/* Show only the updated record of this user */ /* Show only the updated record of this user */
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST, Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,

View File

@ -520,10 +520,10 @@ void Acc_ShowFormChgOtherUsrAccount (void)
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -684,7 +684,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword,NewEncryptedPassword,-1L)) // New password is good? if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword,NewEncryptedPassword,-1L)) // New password is good?
{ {
Error = true; Error = true;
Ale_ShowDelayedAlert (); // Error message is set in Pwd_SlowCheckIfPasswordIsGood Ale_ShowAlerts (NULL); // Error message is set in Pwd_SlowCheckIfPasswordIsGood
} }
return !Error; return !Error;
@ -857,7 +857,7 @@ void Acc_GetUsrCodAndRemUsrGbl (void)
Error = true; Error = true;
if (Error) if (Error)
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -966,7 +966,7 @@ static void Acc_AskIfRemoveOtherUsrAccount (void)
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -373,7 +373,7 @@ void Agd_ShowUsrAgenda (void)
} }
if (Error) if (Error)
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -416,7 +416,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
Box_EndBox (); Box_EndBox ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
/* The current language is not my preferred language /* The current language is not my preferred language

View File

@ -68,31 +68,164 @@ static const char *Ale_AlertIcons[Ale_NUM_ALERT_TYPES] =
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ale_ResetLastAlert (void);
static void Ale_ResetAlert (size_t i);
static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt); static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt);
static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt); static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt);
/*****************************************************************************/ /*****************************************************************************/
/*************************** Reset delayed alert *****************************/ /**************************** Create a new alert *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Ale_ResetDelayedAlert (void) void Ale_CreateAlert (Ale_AlertType_t Type,const char *Section,
const char *fmt,...)
{ {
Gbl.DelayedAlert.Type = Ale_NONE; // Reset alert va_list ap;
Gbl.DelayedAlert.Section = NULL; int NumBytesPrinted;
Gbl.DelayedAlert.Txt[0] = '\0';
if (Gbl.Alerts.Num + 1 > Ale_MAX_ALERTS)
Lay_ShowErrorAndExit ("Too many alerts.");
Gbl.Alerts.Num++;
Gbl.Alerts.List[Gbl.Alerts.Num - 1].Type = Type;
Gbl.Alerts.List[Gbl.Alerts.Num - 1].Section = NULL;
if (Section)
if (Section[0])
Gbl.Alerts.List[Gbl.Alerts.Num - 1].Section = Section;
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Gbl.Alerts.List[Gbl.Alerts.Num - 1].Text,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 an alert message to the user **********************/ /***************** Get current number of delayed alerts **********************/
/*****************************************************************************/ /*****************************************************************************/
void Ale_ShowDelayedAlert (void) unsigned Ale_GetNumAlerts (void)
{ {
if (Gbl.DelayedAlert.Type != Ale_NONE) return Gbl.Alerts.Num;
Ale_ShowFixAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); }
Ale_ResetDelayedAlert (); /*****************************************************************************/
/********************** Get type of last delayed alert ***********************/
/*****************************************************************************/
Ale_AlertType_t Ale_GetTypeOfLastAlert (void)
{
return Gbl.Alerts.Num ? Gbl.Alerts.List[Gbl.Alerts.Num - 1].Type :
Ale_NONE;
}
/*****************************************************************************/
/********************** Get text of last delayed alert ***********************/
/*****************************************************************************/
const char *Ale_GetTextOfLastAlert (void)
{
return Gbl.Alerts.Num ? Gbl.Alerts.List[Gbl.Alerts.Num - 1].Text :
NULL;
}
/*****************************************************************************/
/******************************* Reset alerts ********************************/
/*****************************************************************************/
void Ale_ResetAllAlerts (void)
{
size_t i;
for (i = 0;
i < Gbl.Alerts.Num;
i++)
Ale_ResetAlert (i);
}
static void Ale_ResetLastAlert (void)
{
if (Gbl.Alerts.Num) // There are pending alerts no shown
Ale_ResetAlert (Gbl.Alerts.Num - 1); // Reset the last one
}
static void Ale_ResetAlert (size_t i)
{
bool NoMoreAlertsPending;
size_t j;
if (i < Gbl.Alerts.Num)
if (Gbl.Alerts.List[i].Type != Ale_NONE)
{
/***** Reset i-esim alert *****/
Gbl.Alerts.List[i].Type = Ale_NONE; // Reset alert
Gbl.Alerts.List[i].Section = NULL;
/***** Free memory allocated for text *****/
if (Gbl.Alerts.List[i].Text)
{
free ((void *) Gbl.Alerts.List[i].Text);
Gbl.Alerts.List[i].Text = NULL;
}
}
/***** Set number of alerts to 0
if there are no more alerts
pending to be shown *****/
NoMoreAlertsPending = true;
for (j = 0;
NoMoreAlertsPending && j < Gbl.Alerts.Num;
j++)
if (Gbl.Alerts.List[j].Type != Ale_NONE)
NoMoreAlertsPending = false;
if (NoMoreAlertsPending)
Gbl.Alerts.Num = 0;
}
/*****************************************************************************/
/************************ Show alert messages and exit ***********************/
/*****************************************************************************/
void Ale_ShowAlertsAndExit ()
{
Ale_ShowAlerts (NULL);
Lay_ShowErrorAndExit (NULL);
}
/*****************************************************************************/
/**************************** Show alert messages ****************************/
/*****************************************************************************/
// If Section == NULL ==> show all alerts
// If Section != NULL ==> shown only the alerts assigned to Section
void Ale_ShowAlerts (const char *Section)
{
size_t i;
bool ShowAlert;
for (i = 0;
i < Gbl.Alerts.Num;
i++)
if (Gbl.Alerts.List[i].Type != Ale_NONE)
{
ShowAlert = Section ? (Gbl.Alerts.List[i].Section == Section) :
true;
if (ShowAlert)
{
Ale_ShowFixAlert (Gbl.Alerts.List[i].Type,
Gbl.Alerts.List[i].Text);
Ale_ResetAlert (i);
}
}
} }
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...) void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
@ -131,8 +264,20 @@ static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt)
} }
} }
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit, void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (), const char *OnSubmit,void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton)
{
/***** Show last alert and then reset it *****/
Ale_ShowLastAlertAndButton1 ();
/***** Show button *****/
Ale_ShowAlertAndButton2 (NextAction,Anchor,OnSubmit,
FuncParams,Button,TxtButton);
}
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_AlertType_t AlertType,const char *fmt,...)
{ {
@ -158,6 +303,15 @@ void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const ch
free ((void *) Txt); free ((void *) Txt);
} }
void Ale_ShowLastAlertAndButton1 (void)
{
/***** Show last alert *****/
Ale_ShowFixAlertAndButton1 (Ale_GetTypeOfLastAlert (),Ale_GetTextOfLastAlert ());
/***** Reset last alert *****/
Ale_ResetLastAlert ();
}
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...) void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...)
{ {
va_list ap; va_list ap;
@ -262,13 +416,26 @@ void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const c
"</div>"); "</div>");
} }
/*****************************************************************************/
/** Create alert when user not found or no permission to perform an action ***/
/*****************************************************************************/
void Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission (void)
{
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_User_not_found_or_you_do_not_have_permission_);
}
/*****************************************************************************/ /*****************************************************************************/
/*** Show alert when user not found or no permission to perform an action ****/ /*** Show alert when user not found or no permission to perform an action ****/
/*****************************************************************************/ /*****************************************************************************/
void Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (void) void Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }

View File

@ -35,8 +35,7 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Ale_MAX_BYTES_ALERT (16 * 1024 - 1) // Max. size for alert message #define Ale_MAX_ALERTS 10 // Max. number of alerts stored before of beeing shown
// Important: the size of alert message must be enough large to store the longest message.
/*****************************************************************************/ /*****************************************************************************/
/********************************* Public types ******************************/ /********************************* Public types ******************************/
@ -58,19 +57,32 @@ typedef enum
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Ale_ResetDelayedAlert (void); void Ale_CreateAlert (Ale_AlertType_t Type,const char *Section,
const char *fmt,...);
void Ale_ShowDelayedAlert (void); unsigned Ale_GetNumAlerts (void);
Ale_AlertType_t Ale_GetTypeOfLastAlert (void);
const char *Ale_GetTextOfLastAlert (void);
void Ale_ResetAllAlerts (void);
void Ale_ShowAlertsAndExit ();
void Ale_ShowAlerts (const char *Section);
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...); void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...);
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit, void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (), const char *OnSubmit,void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton);
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_AlertType_t AlertType,const char *fmt,...);
void Ale_ShowLastAlertAndButton1 (void);
void Ale_ShowAlertAndButton1 (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 Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (), void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton); Btn_Button_t Button,const char *TxtButton);
void Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (void); void Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission (void);
void Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (void);
#endif #endif

View File

@ -1348,7 +1348,7 @@ void Asg_RecFormAssignment (void)
else // Folder name not valid else // Folder name not valid
{ {
NewAssignmentIsCorrect = false; NewAssignmentIsCorrect = false;
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
} }
else // NewAsg.SendWork == Asg_DO_NOT_SEND_WORK else // NewAsg.SendWork == Asg_DO_NOT_SEND_WORK

View File

@ -1825,22 +1825,18 @@ void Ctr_ChangeCtrInsInConfig (void)
Gbl.CurrentCtr.Ctr.ShrtName, Gbl.CurrentCtr.Ctr.ShrtName,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
NewIns.InsCod)) NewIns.InsCod))
{ /***** Create warning message *****/
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_centre_X_already_exists,
Txt_The_centre_X_already_exists, Gbl.CurrentCtr.Ctr.ShrtName);
Gbl.CurrentCtr.Ctr.ShrtName);
}
else if (Ctr_CheckIfCtrNameExistsInIns ("FullName", else if (Ctr_CheckIfCtrNameExistsInIns ("FullName",
Gbl.CurrentCtr.Ctr.FullName, Gbl.CurrentCtr.Ctr.FullName,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
NewIns.InsCod)) NewIns.InsCod))
{ /***** Create warning message *****/
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_centre_X_already_exists,
Txt_The_centre_X_already_exists, Gbl.CurrentCtr.Ctr.FullName);
Gbl.CurrentCtr.Ctr.FullName);
}
else else
{ {
/***** Update institution in table of centres *****/ /***** Update institution in table of centres *****/
@ -1851,11 +1847,10 @@ void Ctr_ChangeCtrInsInConfig (void)
/***** Initialize again current course, degree, centre... *****/ /***** Initialize again current course, degree, centre... *****/
Hie_InitHierarchy (); Hie_InitHierarchy ();
/***** Write message to show the change made *****/ /***** Create message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_centre_X_has_been_moved_to_the_institution_Y,
Txt_The_centre_X_has_been_moved_to_the_institution_Y, Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
} }
} }
} }
@ -1867,7 +1862,7 @@ void Ctr_ChangeCtrInsInConfig (void)
void Ctr_ContEditAfterChgCtrInConfig (void) void Ctr_ContEditAfterChgCtrInConfig (void)
{ {
/***** Write error/success message *****/ /***** Write error/success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Ctr_ShowConfiguration (); Ctr_ShowConfiguration ();
@ -1907,11 +1902,10 @@ void Ctr_ChangeCtrPlc (void)
Ctr_UpdateCtrPlcDB (Gbl.Ctrs.EditingCtr.CtrCod,NewPlcCod); Ctr_UpdateCtrPlcDB (Gbl.Ctrs.EditingCtr.CtrCod,NewPlcCod);
Gbl.Ctrs.EditingCtr.PlcCod = NewPlcCod; Gbl.Ctrs.EditingCtr.PlcCod = NewPlcCod;
/***** Write message to show the change made /***** Create alert to show the change made
and put button to go to centre changed *****/ and put button to go to centre changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_place_of_the_centre_has_changed, Txt_The_place_of_the_centre_has_changed);
Ale_MAX_BYTES_ALERT);
Ctr_ShowAlertAndButtonToGoToCtr (); Ctr_ShowAlertAndButtonToGoToCtr ();
/***** Show the form again *****/ /***** Show the form again *****/
@ -2019,12 +2013,9 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewCtrName[0]) if (!NewCtrName[0])
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_centre_X_empty,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentCtrName);
Txt_You_can_not_leave_the_name_of_the_centre_X_empty,
CurrentCtrName);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -2033,21 +2024,18 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
{ {
/***** If degree was in database... *****/ /***** If degree was in database... *****/
if (Ctr_CheckIfCtrNameExistsInIns (ParamName,NewCtrName,Ctr->CtrCod,Gbl.CurrentIns.Ins.InsCod)) if (Ctr_CheckIfCtrNameExistsInIns (ParamName,NewCtrName,Ctr->CtrCod,Gbl.CurrentIns.Ins.InsCod))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_centre_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewCtrName);
Txt_The_centre_X_already_exists,NewCtrName);
}
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Ctr_UpdateInsNameDB (Ctr->CtrCod,FieldName,NewCtrName); Ctr_UpdateInsNameDB (Ctr->CtrCod,FieldName,NewCtrName);
/* Write message to show the change made */ /* Write message to show the change made */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_centre_X_has_been_renamed_as_Y,
Txt_The_centre_X_has_been_renamed_as_Y, CurrentCtrName,NewCtrName);
CurrentCtrName,NewCtrName);
/* Change current centre name in order to display it properly */ /* Change current centre name in order to display it properly */
Str_Copy (CurrentCtrName,NewCtrName, Str_Copy (CurrentCtrName,NewCtrName,
@ -2055,12 +2043,9 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
} }
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_name_of_the_centre_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentCtrName);
Txt_The_name_of_the_centre_X_has_not_changed,
CurrentCtrName);
}
} }
} }
@ -2119,10 +2104,9 @@ void Ctr_ChangeCtrWWW (void)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to centre changed *****/ and put button to go to centre changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_new_web_address_is_X,
Txt_The_new_web_address_is_X, NewWWW);
NewWWW);
Ctr_ShowAlertAndButtonToGoToCtr (); Ctr_ShowAlertAndButtonToGoToCtr ();
} }
else else
@ -2209,10 +2193,9 @@ void Ctr_ChangeCtrStatus (void)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to centre changed *****/ and put button to go to centre changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_status_of_the_centre_X_has_changed,
Txt_The_status_of_the_centre_X_has_changed, Gbl.Ctrs.EditingCtr.ShrtName);
Gbl.Ctrs.EditingCtr.ShrtName);
Ctr_ShowAlertAndButtonToGoToCtr (); Ctr_ShowAlertAndButtonToGoToCtr ();
/***** Show the form again *****/ /***** Show the form again *****/
@ -2251,13 +2234,12 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void)
snprintf (Gbl.Title,sizeof (Gbl.Title), snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Go_to_X, Txt_Go_to_X,
Gbl.Ctrs.EditingCtr.ShrtName); Gbl.Ctrs.EditingCtr.ShrtName);
Ale_ShowAlertAndButton (ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr, Ale_ShowLastAlertAndButton (ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr,
Btn_CONFIRM_BUTTON,Gbl.Title, Btn_CONFIRM_BUTTON,Gbl.Title);
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
} }
else else
/***** Alert *****/ /***** Alert *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
static void Ctr_PutParamGoToCtr (void) static void Ctr_PutParamGoToCtr (void)
@ -2830,10 +2812,9 @@ static void Ctr_CreateCentre (unsigned Status)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to centre created *****/ and put button to go to centre created *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_centre_X,
Txt_Created_new_centre_X, Gbl.Ctrs.EditingCtr.FullName);
Gbl.Ctrs.EditingCtr.FullName);
Ctr_ShowAlertAndButtonToGoToCtr (); Ctr_ShowAlertAndButtonToGoToCtr ();
} }

View File

@ -447,13 +447,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.68.3 (2019-03-08)" #define Log_PLATFORM_VERSION "SWAD 18.69 (2019-03-09)"
#define CSS_FILE "swad18.68.3.css" #define CSS_FILE "swad18.68.3.css"
#define JS_FILE "swad18.64.js" #define JS_FILE "swad18.64.js"
/* /*
* Mostrar "En un tipo de grupo de adscripción única no es posible apuntar estudiantes a más de un grupo" Version 18.69: Mar 09, 2019 Code refactoring related to alerts. (238779 lines)
* también cuando se intenta hacer con un usuario único desde su ficha
*
Version 18.68.3: Mar 08, 2019 Changes in styles of connected users. Version 18.68.3: Mar 08, 2019 Changes in styles of connected users.
Increased line height in timeline, forums and messages. (238945 lines) Increased line height in timeline, forums and messages. (238945 lines)
Version 18.68.2: Mar 08, 2019 Register several students in groups, even if he/she doesn't belong to them. (? lines) Version 18.68.2: Mar 08, 2019 Register several students in groups, even if he/she doesn't belong to them. (? lines)

View File

@ -1889,37 +1889,25 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
/***** If name of course was in database... *****/ /***** If name of course was in database... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L, if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year)) Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.ShrtName);
Txt_The_course_X_already_exists,
Gbl.Degs.EditingCrs.ShrtName);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L, else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year)) Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.FullName);
Txt_The_course_X_already_exists,
Gbl.Degs.EditingCrs.FullName);
}
else // Add new requested course to database else // Add new requested course to database
Crs_CreateCourse (Status); Crs_CreateCourse (Status);
} }
else // If there is not a course name else // If there is not a course name
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course);
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 else // Year not valid
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_year_X_is_not_allowed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.Year);
Txt_The_year_X_is_not_allowed,
Gbl.Degs.EditingCrs.Year);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1971,10 +1959,9 @@ static void Crs_CreateCourse (unsigned Status)
Gbl.Degs.EditingCrs.FullName); Gbl.Degs.EditingCrs.FullName);
/***** Create success message *****/ /***** Create success message *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_course_X,
Txt_Created_new_course_X, Gbl.Degs.EditingCrs.FullName);
Gbl.Degs.EditingCrs.FullName);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2330,18 +2317,15 @@ void Crs_ChangeInsCrsCodInConfig (void)
{ {
Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,NewInstitutionalCrsCod); Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,NewInstitutionalCrsCod);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y, Gbl.CurrentCrs.Crs.ShrtName,
Gbl.CurrentCrs.Crs.ShrtName,NewInstitutionalCrsCod); NewInstitutionalCrsCod);
} }
else // The same institutional code else // The same institutional code
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_institutional_code_of_the_course_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentCrs.Crs.ShrtName);
Txt_The_institutional_code_of_the_course_X_has_not_changed,
Gbl.CurrentCrs.Crs.ShrtName);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2370,18 +2354,15 @@ void Crs_ChangeInsCrsCod (void)
if (strcmp (NewInstitutionalCrsCod,Gbl.Degs.EditingCrs.InstitutionalCrsCod)) if (strcmp (NewInstitutionalCrsCod,Gbl.Degs.EditingCrs.InstitutionalCrsCod))
{ {
Crs_UpdateInstitutionalCrsCod (&Gbl.Degs.EditingCrs,NewInstitutionalCrsCod); Crs_UpdateInstitutionalCrsCod (&Gbl.Degs.EditingCrs,NewInstitutionalCrsCod);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y, Gbl.Degs.EditingCrs.ShrtName,
Gbl.Degs.EditingCrs.ShrtName,NewInstitutionalCrsCod); NewInstitutionalCrsCod);
} }
else // The same institutional code else // The same institutional code
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_institutional_code_of_the_course_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.ShrtName);
Txt_The_institutional_code_of_the_course_X_has_not_changed,
Gbl.Degs.EditingCrs.ShrtName);
}
} }
else else
Lay_NoPermissionExit (); Lay_NoPermissionExit ();
@ -2410,22 +2391,18 @@ void Crs_ChangeCrsDegInConfig (void)
/***** If name of course was in database in the new degree... *****/ /***** If name of course was in database in the new degree... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L, if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year)) NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z, NewDeg.FullName,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName, Gbl.CurrentCrs.Crs.ShrtName);
Gbl.CurrentCrs.Crs.ShrtName);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L, else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year)) NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z, NewDeg.FullName,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName, Gbl.CurrentCrs.Crs.FullName);
Gbl.CurrentCrs.Crs.FullName);
}
else // Update degree in database else // Update degree in database
{ {
/***** Update degree in table of courses *****/ /***** Update degree in table of courses *****/
@ -2436,12 +2413,11 @@ void Crs_ChangeCrsDegInConfig (void)
/***** Initialize again current course, degree, centre... *****/ /***** Initialize again current course, degree, centre... *****/
Hie_InitHierarchy (); Hie_InitHierarchy ();
/***** Create message to show the change made *****/ /***** Create alert to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_course_X_has_been_moved_to_the_degree_Y,
Txt_The_course_X_has_been_moved_to_the_degree_Y, Gbl.CurrentCrs.Crs.FullName,
Gbl.CurrentCrs.Crs.FullName, Gbl.CurrentDeg.Deg.FullName);
Gbl.CurrentDeg.Deg.FullName);
} }
} }
} }
@ -2453,7 +2429,7 @@ void Crs_ChangeCrsDegInConfig (void)
void Crs_ContEditAfterChgCrsInConfig (void) void Crs_ContEditAfterChgCrsInConfig (void)
{ {
/***** Write error/success message *****/ /***** Write error/success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Crs_ShowIntroduction (); Crs_ShowIntroduction ();
@ -2493,39 +2469,31 @@ void Crs_ChangeCrsYearInConfig (void)
/***** If name of course was in database in the new year... *****/ /***** If name of course was in database in the new year... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L, if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear)) Gbl.CurrentCrs.Crs.DegCod,NewYear))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists_in_year_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentCrs.Crs.ShrtName,
Txt_The_course_X_already_exists_in_year_Y, Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.CurrentCrs.Crs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L, else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear)) Gbl.CurrentCrs.Crs.DegCod,NewYear))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists_in_year_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentCrs.Crs.FullName,
Txt_The_course_X_already_exists_in_year_Y, Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.CurrentCrs.Crs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else // Update year in database else // Update year in database
{ {
/***** Update year in table of courses *****/ /***** Update year in table of courses *****/
Crs_UpdateCrsYear (&Gbl.CurrentCrs.Crs,NewYear); Crs_UpdateCrsYear (&Gbl.CurrentCrs.Crs,NewYear);
/***** Create message to show the change made *****/ /***** Create alert to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_year_of_the_course_X_has_changed,
Txt_The_year_of_the_course_X_has_changed, Gbl.CurrentCrs.Crs.ShrtName);
Gbl.CurrentCrs.Crs.ShrtName);
} }
} }
else // Year not valid else // Year not valid
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_year_X_is_not_allowed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewYear);
Txt_The_year_X_is_not_allowed,
NewYear);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2562,39 +2530,31 @@ void Crs_ChangeCrsYear (void)
/***** If name of course was in database in the new year... *****/ /***** If name of course was in database in the new year... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L, if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
Gbl.Degs.EditingCrs.DegCod,NewYear)) Gbl.Degs.EditingCrs.DegCod,NewYear))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists_in_year_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.ShrtName,
Txt_The_course_X_already_exists_in_year_Y, Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Degs.EditingCrs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L, else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
Gbl.Degs.EditingCrs.DegCod,NewYear)) Gbl.Degs.EditingCrs.DegCod,NewYear))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists_in_year_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Degs.EditingCrs.FullName,
Txt_The_course_X_already_exists_in_year_Y, Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Degs.EditingCrs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
}
else // Update year in database else // Update year in database
{ {
/***** Update year in table of courses *****/ /***** Update year in table of courses *****/
Crs_UpdateCrsYear (&Gbl.Degs.EditingCrs,NewYear); Crs_UpdateCrsYear (&Gbl.Degs.EditingCrs,NewYear);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_year_of_the_course_X_has_changed,
Txt_The_year_of_the_course_X_has_changed, Gbl.Degs.EditingCrs.ShrtName);
Gbl.Degs.EditingCrs.ShrtName);
} }
} }
else // Year not valid else // Year not valid
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_year_X_is_not_allowed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewYear);
Txt_The_year_X_is_not_allowed,
NewYear);
}
} }
else else
Lay_NoPermissionExit (); Lay_NoPermissionExit ();
@ -2705,12 +2665,9 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
{ {
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewCrsName[0]) if (!NewCrsName[0])
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_course_X_empty,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentCrsName);
Txt_You_can_not_leave_the_name_of_the_course_X_empty,
CurrentCrsName);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -2720,22 +2677,18 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
/***** If course was in database... *****/ /***** If course was in database... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg (ParamName,NewCrsName,Crs->CrsCod, if (Crs_CheckIfCrsNameExistsInYearOfDeg (ParamName,NewCrsName,Crs->CrsCod,
Crs->DegCod,Crs->Year)) Crs->DegCod,Crs->Year))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_course_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewCrsName);
Txt_The_course_X_already_exists,
NewCrsName);
}
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Crs_UpdateCrsNameDB (Crs->CrsCod,FieldName,NewCrsName); Crs_UpdateCrsNameDB (Crs->CrsCod,FieldName,NewCrsName);
/* Create message to show the change made */ /* Create alert to show the change made */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_name_of_the_course_X_has_changed_to_Y,
Txt_The_name_of_the_course_X_has_changed_to_Y, CurrentCrsName,NewCrsName);
CurrentCrsName,NewCrsName);
/* Change current course name in order to display it properly */ /* Change current course name in order to display it properly */
Str_Copy (CurrentCrsName,NewCrsName, Str_Copy (CurrentCrsName,NewCrsName,
@ -2743,12 +2696,9 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
} }
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_name_of_the_course_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentCrsName);
Txt_The_name_of_the_course_X_has_not_changed,
CurrentCrsName);
}
} }
} }
else else
@ -2817,11 +2767,10 @@ void Crs_ChangeCrsStatus (void)
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod); (unsigned) Status,Gbl.Degs.EditingCrs.CrsCod);
Gbl.Degs.EditingCrs.Status = Status; Gbl.Degs.EditingCrs.Status = Status;
/***** Create message to show the change made *****/ /***** Create alert to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_status_of_the_course_X_has_changed,
Txt_The_status_of_the_course_X_has_changed, Gbl.Degs.EditingCrs.ShrtName);
Gbl.Degs.EditingCrs.ShrtName);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2832,11 +2781,11 @@ void Crs_ContEditAfterChgCrs (void)
{ {
bool PutButtonToRequestRegistration; bool PutButtonToRequestRegistration;
/***** Start alert *****/ if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
{ {
/***** Start alert *****/
Ale_ShowLastAlertAndButton1 ();
/***** Put button to go to course changed *****/ /***** Put button to go to course changed *****/
Crs_PutButtonToGoToCrs (); Crs_PutButtonToGoToCrs ();
@ -2866,10 +2815,13 @@ void Crs_ContEditAfterChgCrs (void)
} }
if (PutButtonToRequestRegistration) if (PutButtonToRequestRegistration)
Crs_PutButtonToRegisterInCrs (); Crs_PutButtonToRegisterInCrs ();
/***** End alert *****/
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
} }
/***** End alert *****/ /***** Show possible delayed alerts *****/
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Crs_EditCourses (); Crs_EditCourses ();

View File

@ -3148,7 +3148,11 @@ void DB_CloseDBConnection (void)
} }
} }
void DB_BuildQuery_old (char **Query,const char *fmt,...) /*****************************************************************************/
/********************** Build a query to be used later ***********************/
/*****************************************************************************/
void DB_BuildQuery (char **Query,const char *fmt,...)
{ {
va_list ap; va_list ap;
int NumBytesPrinted; int NumBytesPrinted;

View File

@ -37,7 +37,7 @@ void DB_CreateTablesIfNotExist (void);
void DB_OpenDBConnection (void); void DB_OpenDBConnection (void);
void DB_CloseDBConnection (void); void DB_CloseDBConnection (void);
void DB_BuildQuery_old (char **Query,const char *fmt,...); void DB_BuildQuery (char **Query,const char *fmt,...);
unsigned long DB_QuerySELECT (MYSQL_RES **mysql_res,const char *MsgError, unsigned long DB_QuerySELECT (MYSQL_RES **mysql_res,const char *MsgError,
const char *fmt,...); const char *fmt,...);

View File

@ -1158,10 +1158,9 @@ static void Deg_CreateDegree (unsigned Status)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to degree created *****/ and put button to go to degree created *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_degree_X,
Txt_Created_new_degree_X, Gbl.Degs.EditingDeg.FullName);
Gbl.Degs.EditingDeg.FullName);
Deg_ShowAlertAndButtonToGoToDeg (); Deg_ShowAlertAndButtonToGoToDeg ();
} }
@ -1973,12 +1972,9 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewDegName[0]) if (!NewDegName[0])
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentDegName);
Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
CurrentDegName);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -1987,22 +1983,18 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
{ {
/***** If degree was in database... *****/ /***** If degree was in database... *****/
if (Deg_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod)) if (Deg_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_degree_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewDegName);
Txt_The_degree_X_already_exists,
NewDegName);
}
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Deg_UpdateDegNameDB (Deg->DegCod,FieldName,NewDegName); Deg_UpdateDegNameDB (Deg->DegCod,FieldName,NewDegName);
/* Write message to show the change made */ /* Write message to show the change made */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_name_of_the_degree_X_has_changed_to_Y,
Txt_The_name_of_the_degree_X_has_changed_to_Y, CurrentDegName,NewDegName);
CurrentDegName,NewDegName);
/* Change current degree name in order to display it properly */ /* Change current degree name in order to display it properly */
Str_Copy (CurrentDegName,NewDegName, Str_Copy (CurrentDegName,NewDegName,
@ -2010,12 +2002,9 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
} }
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_name_of_the_degree_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentDegName);
Txt_The_name_of_the_degree_X_has_not_changed,
CurrentDegName);
}
} }
} }
@ -2067,19 +2056,13 @@ void Deg_ChangeDegCtrInConfig (void)
/***** Check if it already exists a degree with the same name in the new centre *****/ /***** 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)) if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.CurrentDeg.Deg.ShrtName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{ Ale_CreateAlert (Ale_WARNING,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_degree_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentDeg.Deg.ShrtName);
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)) else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.CurrentDeg.Deg.FullName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{ Ale_CreateAlert (Ale_WARNING,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_degree_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentDeg.Deg.FullName);
Txt_The_degree_X_already_exists,
Gbl.CurrentDeg.Deg.FullName);
}
else else
{ {
/***** Update centre in table of degrees *****/ /***** Update centre in table of degrees *****/
@ -2090,12 +2073,11 @@ void Deg_ChangeDegCtrInConfig (void)
/***** Initialize again current course, degree, centre... *****/ /***** Initialize again current course, degree, centre... *****/
Hie_InitHierarchy (); Hie_InitHierarchy ();
/***** Create message to show the change made *****/ /***** Create alert to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Txt_The_degree_X_has_been_moved_to_the_centre_Y, Gbl.CurrentDeg.Deg.FullName,
Gbl.CurrentDeg.Deg.FullName, Gbl.CurrentCtr.Ctr.FullName);
Gbl.CurrentCtr.Ctr.FullName);
} }
} }
} }
@ -2107,7 +2089,7 @@ void Deg_ChangeDegCtrInConfig (void)
void Deg_ContEditAfterChgDegInConfig (void) void Deg_ContEditAfterChgDegInConfig (void)
{ {
/***** Write success / warning message *****/ /***** Write success / warning message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Deg_ShowConfiguration (); Deg_ShowConfiguration ();
@ -2153,12 +2135,11 @@ void Deg_ChangeDegWWW (void)
Str_Copy (Gbl.Degs.EditingDeg.WWW,NewWWW, Str_Copy (Gbl.Degs.EditingDeg.WWW,NewWWW,
Cns_MAX_BYTES_WWW); Cns_MAX_BYTES_WWW);
/***** Write message to show the change made /***** Write alert to show the change made
and put button to go to degree changed *****/ and put button to go to degree changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_new_web_address_is_X,
Txt_The_new_web_address_is_X, NewWWW);
NewWWW);
Deg_ShowAlertAndButtonToGoToDeg (); Deg_ShowAlertAndButtonToGoToDeg ();
} }
else else
@ -2244,12 +2225,11 @@ void Deg_ChangeDegStatus (void)
Gbl.Degs.EditingDeg.Status = Status; Gbl.Degs.EditingDeg.Status = Status;
/***** Write message to show the change made /***** Write alert to show the change made
and put button to go to degree changed *****/ and put button to go to degree changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_status_of_the_degree_X_has_changed,
Txt_The_status_of_the_degree_X_has_changed, Gbl.Degs.EditingDeg.ShrtName);
Gbl.Degs.EditingDeg.ShrtName);
Deg_ShowAlertAndButtonToGoToDeg (); Deg_ShowAlertAndButtonToGoToDeg ();
/***** Show the form again *****/ /***** Show the form again *****/
@ -2288,13 +2268,12 @@ void Deg_ShowAlertAndButtonToGoToDeg (void)
snprintf (Gbl.Title,sizeof (Gbl.Title), snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Go_to_X, Txt_Go_to_X,
Gbl.Degs.EditingDeg.ShrtName); Gbl.Degs.EditingDeg.ShrtName);
Ale_ShowAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg, Ale_ShowLastAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
Btn_CONFIRM_BUTTON,Gbl.Title, Btn_CONFIRM_BUTTON,Gbl.Title);
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
} }
else else
/***** Alert *****/ /***** Alert *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
static void Deg_PutParamGoToDeg (void) static void Deg_PutParamGoToDeg (void)

View File

@ -1019,12 +1019,11 @@ void DT_ChangeDegreeType (void)
"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld", "UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod); NewDegTypCod,Gbl.Degs.EditingDeg.DegCod);
/***** Write message to show the change made /***** Write alert to show the change made
and put button to go to degree changed *****/ and put button to go to degree changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_type_of_degree_of_the_degree_X_has_changed,
Txt_The_type_of_degree_of_the_degree_X_has_changed, Gbl.Degs.EditingDeg.FullName);
Gbl.Degs.EditingDeg.FullName);
Deg_ShowAlertAndButtonToGoToDeg (); Deg_ShowAlertAndButtonToGoToDeg ();
/***** Show the form again *****/ /***** Show the form again *****/

View File

@ -101,10 +101,10 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
Ale_ShowAlert (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user); Ale_ShowAlert (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -244,7 +244,7 @@ void Dup_GetUsrCodAndListSimilarUsrs (void)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
Dup_ListSimilarUsrs (); Dup_ListSimilarUsrs ();
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
static void Dup_ListSimilarUsrs (void) static void Dup_ListSimilarUsrs (void)
@ -451,7 +451,7 @@ void Dup_RemoveUsrFromListDupUsrs (void)
Dup_ListDuplicateUsrs (); Dup_ListDuplicateUsrs ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2151,7 +2151,7 @@ void Enr_AskIfRejectSignUp (void)
} }
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2184,7 +2184,7 @@ void Enr_RejectSignUp (void)
Gbl.Usrs.Other.UsrDat.FullName); Gbl.Usrs.Other.UsrDat.FullName);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/* Show again the rest of registrarion requests */ /* Show again the rest of registrarion requests */
Enr_ShowEnrolmentRequests (); Enr_ShowEnrolmentRequests ();
@ -3382,10 +3382,10 @@ static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
} }
@ -3439,10 +3439,10 @@ void Enr_ReqRemUsrFromCrs (void)
if (Enr_CheckIfICanRemUsrFromCrs ()) if (Enr_CheckIfICanRemUsrFromCrs ())
Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat); Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat);
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3451,8 +3451,6 @@ void Enr_ReqRemUsrFromCrs (void)
void Enr_RemUsrFromCrs1 (void) void Enr_RemUsrFromCrs1 (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
if (Pwd_GetConfirmationOnDangerousAction ()) if (Pwd_GetConfirmationOnDangerousAction ())
{ {
/***** Get user to be removed *****/ /***** Get user to be removed *****/
@ -3462,24 +3460,16 @@ void Enr_RemUsrFromCrs1 (void)
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.CurrentCrs.Crs, Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.CurrentCrs.Crs,
Enr_REMOVE_WORKS,Cns_VERBOSE); Enr_REMOVE_WORKS,Cns_VERBOSE);
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
} }
} }
void Enr_RemUsrFromCrs2 (void) void Enr_RemUsrFromCrs2 (void)
{ {
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3612,10 +3602,10 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
} }
@ -3674,10 +3664,10 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
} }
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
} }
@ -3720,9 +3710,6 @@ void Enr_CreateNewUsr1 (void)
/***** Get user's ID from form *****/ /***** Get user's ID from form *****/
ID_GetParamOtherUsrIDPlain (); // User's ID was already modified and passed as a hidden parameter ID_GetParamOtherUsrIDPlain (); // User's ID was already modified and passed as a hidden parameter
/***** Initialize alert type and message *****/
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID)) // User's ID valid if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID)) // User's ID valid
{ {
Gbl.Usrs.Other.UsrDat.UsrCod = -1L; Gbl.Usrs.Other.UsrDat.UsrCod = -1L;
@ -3750,13 +3737,12 @@ void Enr_CreateNewUsr1 (void)
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole); Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
/* Success message */ /* Success message */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
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,
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B, Gbl.Usrs.Other.UsrDat.FullName,
Gbl.Usrs.Other.UsrDat.FullName, Gbl.CurrentCrs.Crs.FullName,
Gbl.CurrentCrs.Crs.FullName, Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex], Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
} }
} }
else // User does not belong to current course else // User does not belong to current course
@ -3766,11 +3752,10 @@ void Enr_CreateNewUsr1 (void)
Enr_SET_ACCEPTED_TO_FALSE); Enr_SET_ACCEPTED_TO_FALSE);
/* Success message */ /* Success message */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
Txt_THE_USER_X_has_been_enroled_in_the_course_Y, Gbl.Usrs.Other.UsrDat.FullName,
Gbl.Usrs.Other.UsrDat.FullName, Gbl.CurrentCrs.Crs.FullName);
Gbl.CurrentCrs.Crs.FullName);
} }
/***** Change user's groups *****/ /***** Change user's groups *****/
@ -3800,24 +3785,20 @@ void Enr_CreateNewUsr1 (void)
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
} }
else // User's ID not valid else // User's ID not valid
{
/***** Error message *****/ /***** Error message *****/
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_ID_X_is_not_valid,
Txt_The_ID_X_is_not_valid, Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
}
} }
void Enr_CreateNewUsr2 (void) void Enr_CreateNewUsr2 (void)
{ {
if (Gbl.DelayedAlert.Type == Ale_ERROR) // User's ID not valid if (Ale_GetTypeOfLastAlert () == Ale_ERROR) // User's ID not valid
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
else // User's ID valid else // User's ID valid
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
/***** Show optional alert *****/ Ale_ShowAlerts (NULL);
Ale_ShowDelayedAlert ();
/***** Show user's record *****/ /***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -3837,9 +3818,6 @@ void Enr_ModifyUsr1 (void)
Rol_Role_t OldRole; Rol_Role_t OldRole;
Rol_Role_t NewRole; Rol_Role_t NewRole;
/***** Initialize alert type and message *****/
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
/***** Get user from form *****/ /***** Get user from form *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
@ -3878,13 +3856,12 @@ void Enr_ModifyUsr1 (void)
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole); Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
/* Set success message */ /* Set success message */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
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,
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B, Gbl.Usrs.Other.UsrDat.FullName,
Gbl.Usrs.Other.UsrDat.FullName, Gbl.CurrentCrs.Crs.FullName,
Gbl.CurrentCrs.Crs.FullName, Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex], Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
} }
} }
else // User does not belong to current course else // User does not belong to current course
@ -3894,10 +3871,10 @@ void Enr_ModifyUsr1 (void)
Enr_SET_ACCEPTED_TO_FALSE); Enr_SET_ACCEPTED_TO_FALSE);
/* Set success message */ /* Set success message */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
Txt_THE_USER_X_has_been_enroled_in_the_course_Y, Gbl.Usrs.Other.UsrDat.FullName,
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
} }
/***** Change user's groups *****/ /***** Change user's groups *****/
@ -3941,64 +3918,64 @@ void Enr_ModifyUsr1 (void)
} }
} }
else else
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REGISTER_ONE_DEGREE_ADMIN: case Enr_REGISTER_ONE_DEGREE_ADMIN:
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REGISTER_ONE_CENTRE_ADMIN: case Enr_REGISTER_ONE_CENTRE_ADMIN:
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REGISTER_ONE_INSTITUTION_ADMIN: case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE: case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
if (ItsMe || Gbl.Usrs.Me.Role.Logged < Rol_TCH) if (ItsMe || Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REMOVE_ONE_USR_FROM_CRS: case Enr_REMOVE_ONE_USR_FROM_CRS:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_TCH) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REMOVE_ONE_DEGREE_ADMIN: case Enr_REMOVE_ONE_DEGREE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REMOVE_ONE_CENTRE_ADMIN: case Enr_REMOVE_ONE_CENTRE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_REMOVE_ONE_INSTITUTION_ADMIN: case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM: case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
if (!Acc_CheckIfICanEliminateAccount (Gbl.Usrs.Other.UsrDat.UsrCod)) if (!Acc_CheckIfICanEliminateAccount (Gbl.Usrs.Other.UsrDat.UsrCod))
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
default: default:
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
break; break;
} }
} }
else else
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
} }
void Enr_ModifyUsr2 (void) void Enr_ModifyUsr2 (void)
{ {
if (Gbl.DelayedAlert.Type == Ale_WARNING) if (Ale_GetTypeOfLastAlert () == Ale_WARNING)
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlerts (NULL);
else // No error else // No error
switch (Gbl.Usrs.RegRemAction) switch (Gbl.Usrs.RegRemAction)
{ {
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
/***** Show optional alert *****/ /***** Show optional alert *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show user's record *****/ /***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
@ -4105,7 +4082,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
} }
else // User does not belong to current course else // User does not belong to current course
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4116,7 +4093,6 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose) Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose)
{ {
extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y; extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod); bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat)) if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
@ -4184,20 +4160,13 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
} }
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
{ Ale_CreateAlert (Ale_SUCCESS,NULL,
Gbl.DelayedAlert.Type = Ale_SUCCESS; Txt_THE_USER_X_has_been_removed_from_the_course_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), UsrDat->FullName,Crs->FullName);
Txt_THE_USER_X_has_been_removed_from_the_course_Y,
UsrDat->FullName,Crs->FullName);
}
} }
else // User does not belong to course else // User does not belong to course
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -8865,7 +8865,7 @@ void Brw_RecFolderFileBrowser (void)
} }
} }
else // Folder name not valid else // Folder name not valid
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
else else
Lay_ShowErrorAndExit (Txt_You_can_not_create_folders_here); // It's difficult, but not impossible that a user sees this message Lay_ShowErrorAndExit (Txt_You_can_not_create_folders_here); // It's difficult, but not impossible that a user sees this message
@ -8978,7 +8978,7 @@ void Brw_RenFolderFileBrowser (void)
Gbl.FileBrowser.FilFolLnkName); Gbl.FileBrowser.FilFolLnkName);
} }
else // Folder name not valid else // Folder name not valid
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
else else
Lay_ShowErrorAndExit (Txt_You_can_not_rename_this_folder); Lay_ShowErrorAndExit (Txt_You_can_not_rename_this_folder);
@ -9014,7 +9014,7 @@ void Brw_RcvFileInFileBrwDropzone (void)
else else
fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n" fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n"
"%s\n", "%s\n",
Gbl.DelayedAlert.Txt); Ale_GetTextOfLastAlert ());
} }
/*****************************************************************************/ /*****************************************************************************/
@ -9027,7 +9027,7 @@ void Brw_RcvFileInFileBrwClassic (void)
Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD); Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD);
/***** Show possible alert *****/ /***** Show possible alert *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show again file browser *****/ /***** Show again file browser *****/
Brw_ShowAgainFileBrowserOrWorks (); Brw_ShowAgainFileBrowserOrWorks ();
@ -9082,7 +9082,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
/***** Check if uploading this kind of file is allowed *****/ /***** Check if uploading this kind of file is allowed *****/
if (Brw_CheckIfUploadIsAllowed (MIMEType)) // Gbl.Alert.Txt contains feedback text if (Brw_CheckIfUploadIsAllowed (MIMEType)) // Gbl.Alert.Txt contains feedback text
{ {
if (Str_ConvertFilFolLnkNameToValid (Gbl.FileBrowser.NewFilFolLnkName)) // Gbl.DelayedAlert.Txt contains feedback text if (Str_ConvertFilFolLnkNameToValid (Gbl.FileBrowser.NewFilFolLnkName))
{ {
/* Gbl.FileBrowser.NewFilFolLnkName holds the name of the new file */ /* Gbl.FileBrowser.NewFilFolLnkName holds the name of the new file */
snprintf (Path,sizeof (Path), snprintf (Path,sizeof (Path),
@ -9100,12 +9100,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
/* Check if the destination file exists */ /* Check if the destination file exists */
if (Fil_CheckIfPathExists (Path)) if (Fil_CheckIfPathExists (Path))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.FileBrowser.NewFilFolLnkName);
Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName);
}
else // Destination file does not exist else // Destination file does not exist
{ {
/* End receiving the file */ /* End receiving the file */
@ -9126,10 +9123,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
if (rename (PathTmp,Path)) // Fail if (rename (PathTmp,Path)) // Fail
{ {
Fil_RemoveTree (PathTmp); Fil_RemoveTree (PathTmp);
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_UPLOAD_FILE_could_not_create_file_NO_HTML,
Txt_UPLOAD_FILE_could_not_create_file_NO_HTML, Gbl.FileBrowser.NewFilFolLnkName);
Gbl.FileBrowser.NewFilFolLnkName);
} }
else // Success else // Success
{ {
@ -9139,10 +9135,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
if (Brw_CheckIfQuotaExceded ()) if (Brw_CheckIfQuotaExceded ())
{ {
Fil_RemoveTree (Path); Fil_RemoveTree (Path);
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML,
Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML, Gbl.FileBrowser.NewFilFolLnkName);
Gbl.FileBrowser.NewFilFolLnkName);
} }
else else
{ {
@ -9171,11 +9166,10 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
Brw_IS_FOLDER, Brw_IS_FOLDER,
Gbl.FileBrowser.FilFolLnkName, Gbl.FileBrowser.FilFolLnkName,
FileNameToShow); FileNameToShow);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_file_X_has_been_placed_inside_the_folder_Y,
Txt_The_file_X_has_been_placed_inside_the_folder_Y, Gbl.FileBrowser.NewFilFolLnkName,
Gbl.FileBrowser.NewFilFolLnkName, FileNameToShow);
FileNameToShow);
} }
UploadSucessful = true; UploadSucessful = true;
@ -9219,18 +9213,12 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
} }
} }
else // Empty filename else // Empty filename
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML);
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 else // I do not have permission to create files here
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_UPLOAD_FILE_Forbidden_NO_HTML);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_UPLOAD_FILE_Forbidden_NO_HTML,
Ale_MAX_BYTES_ALERT);
}
return UploadSucessful; return UploadSucessful;
} }
@ -9414,7 +9402,7 @@ void Brw_RecLinkFileBrowser (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns true if file type is allowed // Returns true if file type is allowed
// Returns false if MIME type or extension are not allowed // Returns false if MIME type or extension are not allowed
// On error, Gbl.Alert.Txt will contain feedback text // On error, delayed alerts will contain feedback text
static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType) static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
{ {
@ -9429,9 +9417,9 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
/* Check file extension */ /* Check file extension */
if (!Str_FileIsHTML (Gbl.FileBrowser.NewFilFolLnkName)) if (!Str_FileIsHTML (Gbl.FileBrowser.NewFilFolLnkName))
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Ale_CreateAlert (Ale_WARNING,NULL,
Txt_UPLOAD_FILE_X_not_HTML_NO_HTML, Txt_UPLOAD_FILE_X_not_HTML_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName); Gbl.FileBrowser.NewFilFolLnkName);
return false; return false;
} }
@ -9442,9 +9430,9 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
if (strcmp (MIMEType,"application/octetstream")) if (strcmp (MIMEType,"application/octetstream"))
if (strcmp (MIMEType,"application/octet")) if (strcmp (MIMEType,"application/octet"))
{ // MIME type forbidden { // MIME type forbidden
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Ale_CreateAlert (Ale_WARNING,NULL,
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML, Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName,MIMEType); Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
return false; return false;
} }
break; break;
@ -9452,18 +9440,18 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
/* Check file extension */ /* Check file extension */
if (!Ext_CheckIfFileExtensionIsAllowed (Gbl.FileBrowser.NewFilFolLnkName)) if (!Ext_CheckIfFileExtensionIsAllowed (Gbl.FileBrowser.NewFilFolLnkName))
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Ale_CreateAlert (Ale_WARNING,NULL,
Txt_UPLOAD_FILE_X_extension_not_allowed_NO_HTML, Txt_UPLOAD_FILE_X_extension_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName); Gbl.FileBrowser.NewFilFolLnkName);
return false; return false;
} }
/* Check MIME type*/ /* Check MIME type*/
if (!MIM_CheckIfMIMETypeIsAllowed (MIMEType)) if (!MIM_CheckIfMIMETypeIsAllowed (MIMEType))
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Ale_CreateAlert (Ale_WARNING,NULL,
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML, Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
Gbl.FileBrowser.NewFilFolLnkName,MIMEType); Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
return false; return false;
} }
break; break;

View File

@ -663,7 +663,7 @@ void Fol_ListFollowing (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat); Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat);
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // If user not specified, view my profile else // If user not specified, view my profile
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat);
@ -728,7 +728,7 @@ static void Fol_ListFollowingUsr (struct UsrData *UsrDat)
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -745,7 +745,7 @@ void Fol_ListFollowers (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat); Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat);
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // If user not specified, view my profile else // If user not specified, view my profile
Fol_ListFollowersUsr (&Gbl.Usrs.Me.UsrDat); Fol_ListFollowersUsr (&Gbl.Usrs.Me.UsrDat);
@ -818,7 +818,7 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1009,7 +1009,6 @@ static void Fol_PutIconToUnfollow (struct UsrData *UsrDat)
void Fol_FollowUsr1 (void) void Fol_FollowUsr1 (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool CreateNotif; bool CreateNotif;
bool NotifyByEmail; bool NotifyByEmail;
@ -1046,31 +1045,21 @@ void Fol_FollowUsr1 (void)
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0));
} }
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
} }
void Fol_FollowUsr2 (void) void Fol_FollowUsr2 (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
/***** Show user's profile again *****/ /***** Show user's profile again *****/
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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.DelayedAlert.Type != Ale_SUCCESS) if (Ale_GetTypeOfLastAlert () != Ale_SUCCESS)
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1079,8 +1068,6 @@ void Fol_FollowUsr2 (void)
void Fol_UnfollowUsr1 (void) void Fol_UnfollowUsr1 (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
/***** Get user to be unfollowed *****/ /***** Get user to be unfollowed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
@ -1098,20 +1085,16 @@ void Fol_UnfollowUsr1 (void)
/***** Flush cache *****/ /***** Flush cache *****/
Fol_FlushCacheFollow (); Fol_FlushCacheFollow ();
} }
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
Gbl.DelayedAlert.Type = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
Ale_MAX_BYTES_ALERT);
}
} }
void Fol_UnfollowUsr2 (void) void Fol_UnfollowUsr2 (void)
{ {
/***** Get user to be unfollowed *****/ /***** Get user to be unfollowed *****/
if (Gbl.DelayedAlert.Type == Ale_SUCCESS) if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
{ {
/***** Show user's profile again *****/ /***** Show user's profile again *****/
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile
@ -1121,7 +1104,7 @@ void Fol_UnfollowUsr2 (void)
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow
} }
else else
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -4285,6 +4285,7 @@ void For_RemoveThread (void)
extern const char *Txt_Thread_X_removed; extern const char *Txt_Thread_X_removed;
extern const char *Txt_Thread_removed; extern const char *Txt_Thread_removed;
char Subject[Cns_MAX_BYTES_SUBJECT + 1]; char Subject[Cns_MAX_BYTES_SUBJECT + 1];
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
/***** Get parameters related to forum *****/ /***** Get parameters related to forum *****/
For_GetParamsForum (); For_GetParamsForum ();
@ -4304,10 +4305,10 @@ void For_RemoveThread (void)
/***** Show the threads again *****/ /***** Show the threads again *****/
if (Subject[0]) if (Subject[0])
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (Message,sizeof (Message),
Txt_Thread_X_removed,Subject); Txt_Thread_X_removed,Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,Message);
} }
else else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4326,6 +4327,7 @@ void For_CutThread (void)
extern const char *Txt_Thread_X_marked_to_be_moved; extern const char *Txt_Thread_X_marked_to_be_moved;
extern const char *Txt_Thread_marked_to_be_moved; extern const char *Txt_Thread_marked_to_be_moved;
char Subject[Cns_MAX_BYTES_SUBJECT + 1]; char Subject[Cns_MAX_BYTES_SUBJECT + 1];
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
/***** Get parameters related to forum *****/ /***** Get parameters related to forum *****/
For_GetParamsForum (); For_GetParamsForum ();
@ -4342,10 +4344,10 @@ void For_CutThread (void)
/***** Show the threads again *****/ /***** Show the threads again *****/
if (Subject[0]) if (Subject[0])
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (Message,sizeof (Message),
Txt_Thread_X_marked_to_be_moved,Subject); Txt_Thread_X_marked_to_be_moved,Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,Message);
} }
else else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4364,6 +4366,7 @@ void For_PasteThread (void)
extern const char *Txt_Thread_X_moved_to_this_forum; extern const char *Txt_Thread_X_moved_to_this_forum;
extern const char *Txt_Thread_moved_to_this_forum; extern const char *Txt_Thread_moved_to_this_forum;
char Subject[Cns_MAX_BYTES_SUBJECT + 1]; char Subject[Cns_MAX_BYTES_SUBJECT + 1];
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
/***** Get parameters related to forum *****/ /***** Get parameters related to forum *****/
For_GetParamsForum (); For_GetParamsForum ();
@ -4380,11 +4383,11 @@ void For_PasteThread (void)
/***** Show the threads again *****/ /***** Show the threads again *****/
if (Subject[0]) if (Subject[0])
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (Message,sizeof (Message),
Txt_The_thread_X_is_already_in_this_forum, Txt_The_thread_X_is_already_in_this_forum,
Subject); Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_WARNING,Gbl.DelayedAlert.Txt); Ale_WARNING,Message);
} }
else else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
@ -4401,11 +4404,11 @@ void For_PasteThread (void)
/***** Show the threads again *****/ /***** Show the threads again *****/
if (Subject[0]) if (Subject[0])
{ {
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (Message,sizeof (Message),
Txt_Thread_X_moved_to_this_forum, Txt_Thread_X_moved_to_this_forum,
Subject); Subject);
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,Message);
} }
else else
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,

View File

@ -125,7 +125,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.Num = -1; // Number of form. It's increased by 1 at the begin of each form
Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms
Ale_ResetDelayedAlert (); Gbl.Alerts.Num = 0; // No pending alerts to be shown
Gbl.DB.DatabaseIsOpen = false; Gbl.DB.DatabaseIsOpen = false;
Gbl.DB.LockedTables = false; Gbl.DB.LockedTables = false;
@ -540,4 +540,5 @@ void Gbl_Cleanup (void)
Fil_CloseXMLFile (); Fil_CloseXMLFile ();
Fil_CloseReportFile (); Fil_CloseReportFile ();
Par_FreeParams (); Par_FreeParams ();
Ale_ResetAllAlerts ();
} }

View File

@ -107,10 +107,14 @@ struct Globals
} Form; } Form;
struct struct
{ {
Ale_AlertType_t Type; unsigned Num; // Number of alert
char Txt[Ale_MAX_BYTES_ALERT + 1]; struct
const char *Section; // Where to display the alert {
} DelayedAlert; // Alert message created in a function and printed in a subsequent function. Ale_AlertType_t Type;
char *Text;
const char *Section; // Where to display the alert
} List[Ale_MAX_ALERTS];
} Alerts; // Alert message created in a function and printed in a subsequent function.
struct struct
{ {
size_t ContentLength; size_t ContentLength;

View File

@ -85,11 +85,13 @@ extern struct Globals Gbl;
/***************************** Internal prototypes ***************************/ /***************************** Internal prototypes ***************************/
/*****************************************************************************/ /*****************************************************************************/
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes, static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *AlertTextGroupTypes,
Ale_AlertType_t AlertTypeGroups,const char *MessageGroups); Ale_AlertType_t AlertTypeGroups,const char *AlertTextGroups);
static void Grp_ReqEditGroupsInternal0 (void); static void Grp_ReqEditGroupsInternal0 (void);
static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes); static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const char *MessageGroups); const char *AlertTextGroupTypes);
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,
const char *AlertTextGroups);
static void Grp_EditGroupTypes (void); static void Grp_EditGroupTypes (void);
static void Grp_EditGroups (void); static void Grp_EditGroups (void);
@ -213,12 +215,14 @@ void Grp_ReqEditGroups (void)
Ale_INFO,NULL); Ale_INFO,NULL);
} }
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes, static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,
Ale_AlertType_t AlertTypeGroups,const char *MessageGroups) const char *AlertTextGroupTypes,
Ale_AlertType_t AlertTypeGroups,
const char *AlertTextGroups)
{ {
Grp_ReqEditGroupsInternal0 (); Grp_ReqEditGroupsInternal0 ();
Grp_ReqEditGroupsInternal1 (AlertTypeGroupTypes,MessageGroupTypes); Grp_ReqEditGroupsInternal1 (AlertTypeGroupTypes,AlertTextGroupTypes);
Grp_ReqEditGroupsInternal2 (AlertTypeGroups,MessageGroups); Grp_ReqEditGroupsInternal2 (AlertTypeGroups,AlertTextGroups);
} }
static void Grp_ReqEditGroupsInternal0 (void) static void Grp_ReqEditGroupsInternal0 (void)
@ -227,7 +231,8 @@ static void Grp_ReqEditGroupsInternal0 (void)
Lay_StartSection (Grp_GROUP_TYPES_SECTION_ID); Lay_StartSection (Grp_GROUP_TYPES_SECTION_ID);
} }
static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes) static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,
const char *AlertTextGroupTypes)
{ {
/***** Get list of groups types and groups in this course *****/ /***** Get list of groups types and groups in this course *****/
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ALL_GROUP_TYPES); Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ALL_GROUP_TYPES);
@ -236,9 +241,9 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons
Cla_GetListClassrooms (Cla_ONLY_SHRT_NAME); Cla_GetListClassrooms (Cla_ONLY_SHRT_NAME);
/***** Show optional alert *****/ /***** Show optional alert *****/
if (MessageGroupTypes) if (AlertTextGroupTypes)
if (MessageGroupTypes[0]) if (AlertTextGroupTypes[0])
Ale_ShowAlert (AlertTypeGroupTypes,MessageGroupTypes); Ale_ShowAlert (AlertTypeGroupTypes,AlertTextGroupTypes);
/***** Put form to edit group types *****/ /***** Put form to edit group types *****/
Grp_EditGroupTypes (); Grp_EditGroupTypes ();
@ -250,12 +255,13 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons
Lay_StartSection (Grp_GROUPS_SECTION_ID); Lay_StartSection (Grp_GROUPS_SECTION_ID);
} }
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const char *MessageGroups) static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,
const char *AlertTextGroups)
{ {
/***** Show optional alert *****/ /***** Show optional alert *****/
if (MessageGroups) if (AlertTextGroups)
if (MessageGroups[0]) if (AlertTextGroups[0])
Ale_ShowAlert (AlertTypeGroups,MessageGroups); Ale_ShowAlert (AlertTypeGroups,AlertTextGroups);
/***** Put form to edit groups *****/ /***** Put form to edit groups *****/
if (Gbl.CurrentCrs.Grps.GrpTypes.Num) // If there are group types... if (Gbl.CurrentCrs.Grps.GrpTypes.Num) // If there are group types...
@ -671,25 +677,16 @@ void Grp_ChangeMyGrps (Cns_QuietOrVerbose_t QuietOrVerbose)
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
{ {
if (ChangesMade) if (ChangesMade)
{ Ale_CreateAlert (Ale_SUCCESS,NULL,
Gbl.DelayedAlert.Type = Ale_SUCCESS; Txt_The_requested_group_changes_were_successful);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_requested_group_changes_were_successful,
Ale_MAX_BYTES_ALERT);
}
else else
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_There_has_been_no_change_in_groups);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_has_been_no_change_in_groups,
Ale_MAX_BYTES_ALERT);
}
} }
} }
else if (QuietOrVerbose == Cns_VERBOSE) else if (QuietOrVerbose == Cns_VERBOSE)
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group);
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);
}
/***** Free memory with the list of groups which I want to belong to *****/ /***** Free memory with the list of groups which I want to belong to *****/
Grp_FreeListCodGrp (&LstGrpsIWant); Grp_FreeListCodGrp (&LstGrpsIWant);
@ -731,6 +728,9 @@ void Grp_ChangeOtherUsrGrps (void)
/***** Register user in the selected groups *****/ /***** Register user in the selected groups *****/
if (SelectionIsValid) if (SelectionIsValid)
Grp_ChangeGrpsOtherUsrAtomically (&LstGrpsUsrWants); Grp_ChangeGrpsOtherUsrAtomically (&LstGrpsUsrWants);
else
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group);
/***** Free memory with the list of groups to/from which register/remove users *****/ /***** Free memory with the list of groups to/from which register/remove users *****/
Grp_FreeListCodGrp (&LstGrpsUsrWants); Grp_FreeListCodGrp (&LstGrpsUsrWants);
@ -3748,6 +3748,7 @@ void Grp_RecFormNewGrpTyp (void)
extern const char *Txt_Created_new_type_of_group_X; extern const char *Txt_Created_new_type_of_group_X;
extern const char *Txt_You_must_specify_the_name_of_the_new_type_of_group; extern const char *Txt_You_must_specify_the_name_of_the_new_type_of_group;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the name of group type */ /* Get the name of group type */
@ -3770,7 +3771,7 @@ void Grp_RecFormNewGrpTyp (void)
if (Grp_CheckIfGroupTypeNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,-1L)) if (Grp_CheckIfGroupTypeNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,-1L))
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_group_X_already_exists, Txt_The_type_of_group_X_already_exists,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
} }
@ -3779,7 +3780,7 @@ void Grp_RecFormNewGrpTyp (void)
Grp_CreateGroupType (); Grp_CreateGroupType ();
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_Created_new_type_of_group_X, Txt_Created_new_type_of_group_X,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
} }
@ -3787,12 +3788,12 @@ void Grp_RecFormNewGrpTyp (void)
else // If there is not a group type name else // If there is not a group type name
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_type_of_group, Str_Copy (AlertTxt,Txt_You_must_specify_the_name_of_the_new_type_of_group,
Ale_MAX_BYTES_ALERT); sizeof (AlertTxt) - 1);
} }
/***** Show the form again *****/ /***** Show the form again *****/
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -3820,6 +3821,7 @@ void Grp_RecFormNewGrp (void)
extern const char *Txt_Created_new_group_X; extern const char *Txt_Created_new_group_X;
extern const char *Txt_You_must_specify_the_name_of_the_new_group; extern const char *Txt_You_must_specify_the_name_of_the_new_group;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
if ((Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) > 0) // Group type valid if ((Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) > 0) // Group type valid
@ -3844,7 +3846,7 @@ void Grp_RecFormNewGrp (void)
if (Grp_CheckIfGroupNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,Gbl.CurrentCrs.Grps.GrpName,-1L)) if (Grp_CheckIfGroupNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,Gbl.CurrentCrs.Grps.GrpName,-1L))
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_already_exists, Txt_The_group_X_already_exists,
Gbl.CurrentCrs.Grps.GrpName); Gbl.CurrentCrs.Grps.GrpName);
} }
@ -3854,7 +3856,7 @@ void Grp_RecFormNewGrp (void)
/* Write success message */ /* Write success message */
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_Created_new_group_X, Txt_Created_new_group_X,
Gbl.CurrentCrs.Grps.GrpName); Gbl.CurrentCrs.Grps.GrpName);
} }
@ -3862,20 +3864,20 @@ void Grp_RecFormNewGrp (void)
else // If there is not a group name else // If there is not a group name
{ {
AlertType = Ale_ERROR; AlertType = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_group, Str_Copy (AlertTxt,Txt_You_must_specify_the_name_of_the_new_group,
Ale_MAX_BYTES_ALERT); sizeof (AlertTxt) - 1);
} }
} }
else // Invalid group type else // Invalid group type
{ {
AlertType = Ale_ERROR; AlertType = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong type of group.", Str_Copy (AlertTxt,"Wrong type of group.",
Ale_MAX_BYTES_ALERT); sizeof (AlertTxt) - 1);
} }
/***** Show the form again *****/ /***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.DelayedAlert.Txt); AlertType,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4118,6 +4120,7 @@ void Grp_RemoveGroup (void)
static void Grp_RemoveGroupTypeCompletely (void) static void Grp_RemoveGroupTypeCompletely (void)
{ {
extern const char *Txt_Type_of_group_X_removed; extern const char *Txt_Type_of_group_X_removed;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
/***** Get name and type of the group from database *****/ /***** Get name and type of the group from database *****/
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp); Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
@ -4158,12 +4161,12 @@ static void Grp_RemoveGroupTypeCompletely (void)
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_Type_of_group_X_removed, Txt_Type_of_group_X_removed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
/***** Show the form again *****/ /***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (Ale_SUCCESS,AlertTxt,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -4175,6 +4178,7 @@ static void Grp_RemoveGroupCompletely (void)
{ {
extern const char *Txt_Group_X_removed; extern const char *Txt_Group_X_removed;
struct GroupData GrpDat; struct GroupData GrpDat;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get name and type of the group from database *****/ /***** Get name and type of the group from database *****/
GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod; GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
@ -4208,13 +4212,13 @@ static void Grp_RemoveGroupCompletely (void)
Gbl.CurrentCrs.Grps.GrpCod); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_Group_X_removed, Txt_Group_X_removed,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4225,6 +4229,7 @@ void Grp_OpenGroup (void)
{ {
extern const char *Txt_The_group_X_is_now_open; extern const char *Txt_The_group_X_is_now_open;
struct GroupData GrpDat; struct GroupData GrpDat;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
@ -4240,14 +4245,14 @@ void Grp_OpenGroup (void)
Gbl.CurrentCrs.Grps.GrpCod); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_is_now_open, Txt_The_group_X_is_now_open,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.Open = true; Gbl.CurrentCrs.Grps.Open = true;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4258,6 +4263,7 @@ void Grp_CloseGroup (void)
{ {
extern const char *Txt_The_group_X_is_now_closed; extern const char *Txt_The_group_X_is_now_closed;
struct GroupData GrpDat; struct GroupData GrpDat;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
@ -4273,14 +4279,14 @@ void Grp_CloseGroup (void)
Gbl.CurrentCrs.Grps.GrpCod); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_is_now_closed, Txt_The_group_X_is_now_closed,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.Open = false; Gbl.CurrentCrs.Grps.Open = false;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4291,6 +4297,7 @@ void Grp_EnableFileZonesGrp (void)
{ {
extern const char *Txt_File_zones_of_the_group_X_are_now_enabled; extern const char *Txt_File_zones_of_the_group_X_are_now_enabled;
struct GroupData GrpDat; struct GroupData GrpDat;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
@ -4306,14 +4313,14 @@ void Grp_EnableFileZonesGrp (void)
Gbl.CurrentCrs.Grps.GrpCod); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_File_zones_of_the_group_X_are_now_enabled, Txt_File_zones_of_the_group_X_are_now_enabled,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.FileZones = true; Gbl.CurrentCrs.Grps.FileZones = true;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4324,6 +4331,7 @@ void Grp_DisableFileZonesGrp (void)
{ {
extern const char *Txt_File_zones_of_the_group_X_are_now_disabled; extern const char *Txt_File_zones_of_the_group_X_are_now_disabled;
struct GroupData GrpDat; struct GroupData GrpDat;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
@ -4339,14 +4347,14 @@ void Grp_DisableFileZonesGrp (void)
Gbl.CurrentCrs.Grps.GrpCod); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_File_zones_of_the_group_X_are_now_disabled, Txt_File_zones_of_the_group_X_are_now_disabled,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.FileZones = false; Gbl.CurrentCrs.Grps.FileZones = false;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
Ale_SUCCESS,Gbl.DelayedAlert.Txt); Ale_SUCCESS,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4360,6 +4368,7 @@ void Grp_ChangeGroupType (void)
long NewGrpTypCod; long NewGrpTypCod;
struct GroupData GrpDat; struct GroupData GrpDat;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get group code */ /* Get group code */
@ -4378,7 +4387,7 @@ void Grp_ChangeGroupType (void)
{ {
/* Create warning message */ /* Create warning message */
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_already_exists, Txt_The_group_X_already_exists,
GrpDat.GrpName); GrpDat.GrpName);
} }
@ -4391,7 +4400,7 @@ void Grp_ChangeGroupType (void)
/* Create message to show the change made */ /* Create message to show the change made */
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_group_of_the_group_X_has_changed, Txt_The_type_of_group_of_the_group_X_has_changed,
GrpDat.GrpName); GrpDat.GrpName);
} }
@ -4399,7 +4408,7 @@ void Grp_ChangeGroupType (void)
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod; Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.DelayedAlert.Txt); AlertType,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4412,6 +4421,7 @@ void Grp_ChangeGroupClassroom (void)
long NewClaCod; long NewClaCod;
struct GroupData GrpDat; struct GroupData GrpDat;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get group code */ /* Get group code */
@ -4432,14 +4442,14 @@ void Grp_ChangeGroupClassroom (void)
/* Create message to show the change made */ /* Create message to show the change made */
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_classroom_assigned_to_the_group_X_has_changed, Txt_The_classroom_assigned_to_the_group_X_has_changed,
GrpDat.GrpName); GrpDat.GrpName);
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.ClaCod = NewClaCod; Gbl.CurrentCrs.Grps.ClaCod = NewClaCod;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.DelayedAlert.Txt); AlertType,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4453,6 +4463,7 @@ void Grp_ChangeMandatGrpTyp (void)
extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary; extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary;
bool NewMandatoryEnrolment; bool NewMandatoryEnrolment;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the código of type of group */ /* Get the código of type of group */
@ -4470,7 +4481,7 @@ void Grp_ChangeMandatGrpTyp (void)
if (Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment) if (Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment)
{ {
AlertType = Ale_INFO; AlertType = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed, Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
} }
@ -4485,7 +4496,7 @@ void Grp_ChangeMandatGrpTyp (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
NewMandatoryEnrolment ? Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_mandatory : 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, Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
@ -4493,7 +4504,7 @@ void Grp_ChangeMandatGrpTyp (void)
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment; Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment;
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -4508,6 +4519,7 @@ void Grp_ChangeMultiGrpTyp (void)
extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X; extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X;
bool NewMultipleEnrolment; bool NewMultipleEnrolment;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
/***** Get parameters from the form *****/ /***** Get parameters from the form *****/
/* Get the code of type of group */ /* Get the code of type of group */
@ -4525,7 +4537,7 @@ void Grp_ChangeMultiGrpTyp (void)
if (Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment) if (Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment)
{ {
AlertType = Ale_INFO; AlertType = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed, Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
} }
@ -4541,7 +4553,7 @@ void Grp_ChangeMultiGrpTyp (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
NewMultipleEnrolment ? Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X : 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, Txt_Now_each_student_can_only_belong_to_a_group_of_type_X,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
@ -4549,7 +4561,7 @@ void Grp_ChangeMultiGrpTyp (void)
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment; Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment;
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -4587,7 +4599,7 @@ void Grp_ChangeOpenTimeGrpTyp (void)
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
/***** Show the form again *****/ /***** Show the form again *****/
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (Ale_SUCCESS,NULL,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -4603,6 +4615,7 @@ void Grp_ChangeMaxStdsGrp (void)
struct GroupData GrpDat; struct GroupData GrpDat;
unsigned NewMaxStds; unsigned NewMaxStds;
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get group code */ /* Get group code */
@ -4625,7 +4638,7 @@ void Grp_ChangeMaxStdsGrp (void)
if (GrpDat.MaxStudents == NewMaxStds) if (GrpDat.MaxStudents == NewMaxStds)
{ {
AlertType = Ale_INFO; AlertType = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_maximum_number_of_students_in_group_X_has_not_changed, Txt_The_maximum_number_of_students_in_group_X_has_not_changed,
GrpDat.GrpName); GrpDat.GrpName);
} }
@ -4640,11 +4653,11 @@ void Grp_ChangeMaxStdsGrp (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP) if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP)
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_does_not_have_a_student_limit_now, Txt_The_group_X_does_not_have_a_student_limit_now,
GrpDat.GrpName); GrpDat.GrpName);
else else
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_maximum_number_of_students_in_group_X_is_now_Y, Txt_The_maximum_number_of_students_in_group_X_is_now_Y,
GrpDat.GrpName,NewMaxStds); GrpDat.GrpName,NewMaxStds);
} }
@ -4652,7 +4665,7 @@ void Grp_ChangeMaxStdsGrp (void)
/***** Show the form again *****/ /***** Show the form again *****/
Gbl.CurrentCrs.Grps.MaxStudents = NewMaxStds; Gbl.CurrentCrs.Grps.MaxStudents = NewMaxStds;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.DelayedAlert.Txt); AlertType,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4692,6 +4705,7 @@ void Grp_RenameGroupType (void)
extern const char *Txt_The_name_of_the_type_of_group_X_has_not_changed; extern const char *Txt_The_name_of_the_type_of_group_X_has_not_changed;
char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1]; char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the group type */ /* Get the code of the group type */
@ -4708,7 +4722,7 @@ void Grp_RenameGroupType (void)
if (!NewNameGrpTyp[0]) if (!NewNameGrpTyp[0])
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_You_can_not_leave_the_name_of_the_type_of_group_X_empty, Txt_You_can_not_leave_the_name_of_the_type_of_group_X_empty,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
} }
@ -4722,7 +4736,7 @@ void Grp_RenameGroupType (void)
if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod)) if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod))
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_group_X_already_exists, Txt_The_type_of_group_X_already_exists,
NewNameGrpTyp); NewNameGrpTyp);
} }
@ -4737,7 +4751,7 @@ void Grp_RenameGroupType (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_type_of_group_X_has_been_renamed_as_Y, Txt_The_type_of_group_X_has_been_renamed_as_Y,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp);
} }
@ -4745,7 +4759,7 @@ void Grp_RenameGroupType (void)
else // The same name else // The same name
{ {
AlertType = Ale_INFO; AlertType = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_name_of_the_type_of_group_X_has_not_changed, Txt_The_name_of_the_type_of_group_X_has_not_changed,
NewNameGrpTyp); NewNameGrpTyp);
} }
@ -4754,7 +4768,7 @@ void Grp_RenameGroupType (void)
/***** Show the form again *****/ /***** Show the form again *****/
Str_Copy (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp, Str_Copy (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp,
Grp_MAX_BYTES_GROUP_TYPE_NAME); Grp_MAX_BYTES_GROUP_TYPE_NAME);
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt, Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
Ale_INFO,NULL); Ale_INFO,NULL);
} }
@ -4771,6 +4785,7 @@ void Grp_RenameGroup (void)
struct GroupData GrpDat; struct GroupData GrpDat;
char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1]; char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1];
Ale_AlertType_t AlertType; Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the group */ /* Get the code of the group */
@ -4788,7 +4803,7 @@ void Grp_RenameGroup (void)
if (!NewNameGrp[0]) if (!NewNameGrp[0])
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_You_can_not_leave_the_name_of_the_group_X_empty, Txt_You_can_not_leave_the_name_of_the_group_X_empty,
GrpDat.GrpName); GrpDat.GrpName);
} }
@ -4802,7 +4817,7 @@ void Grp_RenameGroup (void)
if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod)) if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod))
{ {
AlertType = Ale_WARNING; AlertType = Ale_WARNING;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_already_exists, Txt_The_group_X_already_exists,
NewNameGrp); NewNameGrp);
} }
@ -4815,7 +4830,7 @@ void Grp_RenameGroup (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_group_X_has_been_renamed_as_Y, Txt_The_group_X_has_been_renamed_as_Y,
GrpDat.GrpName,NewNameGrp); GrpDat.GrpName,NewNameGrp);
} }
@ -4823,7 +4838,7 @@ void Grp_RenameGroup (void)
else // The same name else // The same name
{ {
AlertType = Ale_INFO; AlertType = Ale_INFO;
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_name_of_the_group_X_has_not_changed, Txt_The_name_of_the_group_X_has_not_changed,
NewNameGrp); NewNameGrp);
} }
@ -4833,7 +4848,7 @@ void Grp_RenameGroup (void)
Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp, Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp,
Grp_MAX_BYTES_GROUP_NAME); Grp_MAX_BYTES_GROUP_NAME);
Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,Gbl.DelayedAlert.Txt); AlertType,AlertTxt);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -681,16 +681,15 @@ void Hld_RemoveHoliday1 (void)
Hld.HldCod); Hld.HldCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Holiday_X_removed,
Txt_Holiday_X_removed, Hld.Name);
Hld.Name);
} }
void Hld_RemoveHoliday2 (void) void Hld_RemoveHoliday2 (void)
{ {
/***** Show success message *****/ /***** Show success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();
@ -731,16 +730,15 @@ void Hld_ChangeHolidayPlace1 (void)
Plc_MAX_BYTES_PLACE_FULL_NAME); Plc_MAX_BYTES_PLACE_FULL_NAME);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_place_of_the_holiday_X_has_changed_to_Y,
Txt_The_place_of_the_holiday_X_has_changed_to_Y, Hld->Name,NewPlace.FullName);
Hld->Name,NewPlace.FullName);
} }
void Hld_ChangeHolidayPlace2 (void) void Hld_ChangeHolidayPlace2 (void)
{ {
/***** Show success message *****/ /***** Show success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();
@ -775,16 +773,15 @@ void Hld_ChangeHolidayType1 (void)
(unsigned) Hld->HldTyp,Hld->HldCod); (unsigned) Hld->HldTyp,Hld->HldCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_type_of_the_holiday_X_has_changed,
Txt_The_type_of_the_holiday_X_has_changed, Hld->Name);
Hld->Name);
} }
void Hld_ChangeHolidayType2 (void) void Hld_ChangeHolidayType2 (void)
{ {
/***** Show success message *****/ /***** Show success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();
@ -874,11 +871,10 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
Dat_AssignDate (PtrDate,&NewDate); Dat_AssignDate (PtrDate,&NewDate);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS;
Dat_ConvDateToDateStr (&NewDate,StrDate); Dat_ConvDateToDateStr (&NewDate,StrDate);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_date_of_the_holiday_X_has_changed_to_Y, Txt_The_date_of_the_holiday_X_has_changed_to_Y,
Hld->Name,StrDate); Hld->Name,StrDate);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -888,7 +884,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
void Hld_ChangeDate2 (void) void Hld_ChangeDate2 (void)
{ {
/***** Show success message *****/ /***** Show success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();
@ -921,12 +917,9 @@ void Hld_RenameHoliday1 (void)
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewHldName[0]) if (!NewHldName[0])
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_holiday_X_empty,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Hld->Name);
Txt_You_can_not_leave_the_name_of_the_holiday_X_empty,
Hld->Name);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -942,25 +935,21 @@ void Hld_RenameHoliday1 (void)
Hld_MAX_BYTES_HOLIDAY_NAME); Hld_MAX_BYTES_HOLIDAY_NAME);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_name_of_the_holiday_X_has_changed_to_Y,
Txt_The_name_of_the_holiday_X_has_changed_to_Y, Hld->Name,NewHldName);
Hld->Name,NewHldName);
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_name_of_the_holiday_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Hld->Name);
Txt_The_name_of_the_holiday_X_has_not_changed,
Hld->Name);
}
} }
} }
void Hld_RenameHoliday2 (void) void Hld_RenameHoliday2 (void)
{ {
/***** Write error/success message *****/ /***** Write error/success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();
@ -1181,24 +1170,20 @@ void Hld_RecFormNewHoliday1 (void)
Hld_CreateHoliday (Hld); Hld_CreateHoliday (Hld);
/* Success message */ /* Success message */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_holiday_X,
Txt_Created_new_holiday_X, Hld->Name);
Hld->Name);
} }
else // If there is not a holiday name else // If there is not a holiday name
{
/* Error message */ /* Error message */
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_holiday, Txt_You_must_specify_the_name_of_the_new_holiday);
Ale_MAX_BYTES_ALERT);
}
} }
void Hld_RecFormNewHoliday2 (void) void Hld_RecFormNewHoliday2 (void)
{ {
/***** Write error/success message *****/ /***** Write error/success message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Hld_EditHolidays (); Hld_EditHolidays ();

View File

@ -94,7 +94,10 @@ static void Ins_PutParamOtherInsCod (long InsCod);
static long Ins_GetParamOtherInsCod (void); static long Ins_GetParamOtherInsCod (void);
static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName); static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod); static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,
const char *Name,
long InsCod,
long CtyCod);
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName); static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName);
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod); static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod);
@ -1837,12 +1840,9 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewInsName[0]) if (!NewInsName[0])
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentInsName);
Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
CurrentInsName);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -1850,23 +1850,20 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
if (strcmp (CurrentInsName,NewInsName)) // Different names if (strcmp (CurrentInsName,NewInsName)) // Different names
{ {
/***** If institution was in database... *****/ /***** If institution was in database... *****/
if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,Gbl.CurrentCty.Cty.CtyCod)) if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,
{ Gbl.CurrentCty.Cty.CtyCod))
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_institution_X_already_exists,
Txt_The_institution_X_already_exists, NewInsName);
NewInsName);
}
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Ins_UpdateInsNameDB (Ins->InsCod,FieldName,NewInsName); Ins_UpdateInsNameDB (Ins->InsCod,FieldName,NewInsName);
/* Create message to show the change made */ /* Create message to show the change made */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_institution_X_has_been_renamed_as_Y,
Txt_The_institution_X_has_been_renamed_as_Y, CurrentInsName,NewInsName);
CurrentInsName,NewInsName);
/* Change current institution name in order to display it properly */ /* Change current institution name in order to display it properly */
Str_Copy (CurrentInsName,NewInsName, Str_Copy (CurrentInsName,NewInsName,
@ -1874,12 +1871,9 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
} }
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,NULL,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_name_of_the_institution_X_has_not_changed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentInsName);
Txt_The_name_of_the_institution_X_has_not_changed,
CurrentInsName);
}
} }
} }
@ -1887,7 +1881,10 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
/****** Check if the name of institution exists in the current country *******/ /****** Check if the name of institution exists in the current country *******/
/*****************************************************************************/ /*****************************************************************************/
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod) static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,
const char *Name,
long InsCod,
long CtyCod)
{ {
/***** Get number of institutions in current country with a name from database *****/ /***** Get number of institutions in current country with a name from database *****/
return (DB_QueryCOUNT ("can not check if the name of an institution" return (DB_QueryCOUNT ("can not check if the name of an institution"
@ -1934,19 +1931,13 @@ void Ins_ChangeInsCtyInConfig (void)
/***** Check if it already exists an institution with the same name in the new country *****/ /***** 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)) if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.CurrentIns.Ins.ShrtName,-1L,NewCty.CtyCod))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_institution_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentIns.Ins.ShrtName);
Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.ShrtName);
}
else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.CurrentIns.Ins.FullName,-1L,NewCty.CtyCod)) else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.CurrentIns.Ins.FullName,-1L,NewCty.CtyCod))
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_institution_X_already_exists,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.CurrentIns.Ins.FullName);
Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.FullName);
}
else else
{ {
/***** Update the table changing the country of the institution *****/ /***** Update the table changing the country of the institution *****/
@ -1958,10 +1949,9 @@ void Ins_ChangeInsCtyInConfig (void)
Hie_InitHierarchy (); Hie_InitHierarchy ();
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_country_of_the_institution_X_has_changed_to_Y,
Txt_The_country_of_the_institution_X_has_changed_to_Y, Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
} }
} }
} }
@ -1973,7 +1963,7 @@ void Ins_ChangeInsCtyInConfig (void)
void Ins_ContEditAfterChgInsInConfig (void) void Ins_ContEditAfterChgInsInConfig (void)
{ {
/***** Write success / warning message *****/ /***** Write success / warning message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show the form again *****/ /***** Show the form again *****/
Ins_ShowConfiguration (); Ins_ShowConfiguration ();
@ -2021,10 +2011,9 @@ void Ins_ChangeInsWWW (void)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to institution changed *****/ and put button to go to institution changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_new_web_address_is_X,
Txt_The_new_web_address_is_X, NewWWW);
NewWWW);
Ins_ShowAlertAndButtonToGoToIns (); Ins_ShowAlertAndButtonToGoToIns ();
} }
else else
@ -2111,10 +2100,9 @@ void Ins_ChangeInsStatus (void)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to institution changed *****/ and put button to go to institution changed *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_The_status_of_the_institution_X_has_changed,
Txt_The_status_of_the_institution_X_has_changed, Gbl.Inss.EditingIns.ShrtName);
Gbl.Inss.EditingIns.ShrtName);
Ins_ShowAlertAndButtonToGoToIns (); Ins_ShowAlertAndButtonToGoToIns ();
/***** Show the form again *****/ /***** Show the form again *****/
@ -2149,12 +2137,11 @@ static void Ins_ShowAlertAndButtonToGoToIns (void)
// If the institution beeing edited is different to the current one... // If the institution beeing edited is different to the current one...
if (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod) if (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod)
/***** Alert with button to go to degree *****/ /***** Alert with button to go to degree *****/
Ale_ShowAlertAndButton (ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns, Ale_ShowLastAlertAndButton (ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
Btn_CONFIRM_BUTTON,Gbl.Title, Btn_CONFIRM_BUTTON,Gbl.Title);
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
else else
/***** Alert *****/ /***** Alert *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
static void Ins_PutParamGoToIns (void) static void Ins_PutParamGoToIns (void)
@ -2431,10 +2418,9 @@ static void Ins_CreateInstitution (unsigned Status)
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to institution created *****/ and put button to go to institution created *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_Created_new_institution_X,
Txt_Created_new_institution_X, Gbl.Inss.EditingIns.FullName);
Gbl.Inss.EditingIns.FullName);
Ins_ShowAlertAndButtonToGoToIns (); Ins_ShowAlertAndButtonToGoToIns ();
} }

View File

@ -627,13 +627,9 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (!NewMaiName[0]) if (!NewMaiName[0])
{ Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_leave_the_name_of_the_email_domain_X_empty,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; CurrentMaiName);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_You_can_not_leave_the_name_of_the_email_domain_X_empty,
CurrentMaiName);
}
else else
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
@ -642,34 +638,24 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** If mail was in database... *****/ /***** If mail was in database... *****/
if (Mai_CheckIfMailDomainNameExists (ParamName,NewMaiName,Mai->MaiCod)) if (Mai_CheckIfMailDomainNameExists (ParamName,NewMaiName,Mai->MaiCod))
{ Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_email_domain_X_already_exists,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; NewMaiName);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_domain_X_already_exists,
NewMaiName);
}
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Mai_UpdateMailDomainNameDB (Mai->MaiCod,FieldName,NewMaiName); Mai_UpdateMailDomainNameDB (Mai->MaiCod,FieldName,NewMaiName);
/* Write message to show the change made */ /* Write message to show the change made */
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; Txt_The_email_domain_X_has_been_renamed_as_Y,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), CurrentMaiName,NewMaiName);
Txt_The_email_domain_X_has_been_renamed_as_Y,
CurrentMaiName,NewMaiName);
} }
} }
else // The same name else // The same name
{ Ale_CreateAlert (Ale_INFO,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_INFO; Txt_The_email_domain_X_has_not_changed,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; CurrentMaiName);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_domain_X_has_not_changed,
CurrentMaiName);
}
} }
/***** Show the form again *****/ /***** Show the form again *****/
@ -1215,9 +1201,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
bool Confirmed; bool Confirmed;
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Show possible alert *****/ /***** Show possible alerts *****/
if (Gbl.DelayedAlert.Section == (const char *) Mai_EMAIL_SECTION_ID) Ale_ShowAlerts (Mai_EMAIL_SECTION_ID);
Ale_ShowDelayedAlert ();
/***** Help message *****/ /***** Help message *****/
if (IMustFillInEmail) if (IMustFillInEmail)
@ -1427,10 +1412,10 @@ void Mai_RemoveOtherUsrEmail (void)
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1450,18 +1435,16 @@ static void Mai_RemoveEmail (struct UsrData *UsrDat)
/***** Remove one of user's old email addresses *****/ /***** Remove one of user's old email addresses *****/
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email); Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
/***** Show message *****/ /***** Create alert *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; Txt_Email_X_removed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Email);
Txt_Email_X_removed,
Email);
/***** Update list of emails *****/ /***** Update list of emails *****/
Mai_GetEmailFromUsrCod (UsrDat); Mai_GetEmailFromUsrCod (UsrDat);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1512,10 +1495,10 @@ void Mai_NewOtherUsrEmail (void)
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1528,7 +1511,6 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
extern const char *Txt_The_email_address_X_has_been_registered_successfully; extern const char *Txt_The_email_address_X_has_been_registered_successfully;
extern const char *Txt_The_email_address_X_had_been_registered_by_another_user; extern const char *Txt_The_email_address_X_had_been_registered_by_another_user;
extern const char *Txt_The_email_address_entered_X_is_not_valid; extern const char *Txt_The_email_address_entered_X_is_not_valid;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
if (Usr_ICanEditOtherUsr (UsrDat)) if (Usr_ICanEditOtherUsr (UsrDat))
@ -1541,23 +1523,17 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
/***** Check if new email exists in database *****/ /***** Check if new email exists in database *****/
if (UsrDat->EmailConfirmed && if (UsrDat->EmailConfirmed &&
!strcmp (UsrDat->Email,NewEmail)) // User's current confirmed email match exactly the new email !strcmp (UsrDat->Email,NewEmail)) // User's current confirmed email match exactly the new email
{ Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_email_address_X_matches_one_previously_registered,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; NewEmail);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_X_matches_one_previously_registered,
NewEmail);
}
else else
{ {
if (Mai_UpdateEmailInDB (UsrDat,NewEmail)) if (Mai_UpdateEmailInDB (UsrDat,NewEmail))
{ {
/***** Email updated sucessfully *****/ /***** Email updated sucessfully *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; Txt_The_email_address_X_has_been_registered_successfully,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewEmail);
Txt_The_email_address_X_has_been_registered_successfully,
NewEmail);
/***** Update list of emails *****/ /***** Update list of emails *****/
Mai_GetEmailFromUsrCod (UsrDat); Mai_GetEmailFromUsrCod (UsrDat);
@ -1568,31 +1544,18 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
Mai_SendMailMsgToConfirmEmail (); Mai_SendMailMsgToConfirmEmail ();
} }
else else
{ Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_email_address_X_had_been_registered_by_another_user,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; NewEmail);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_X_had_been_registered_by_another_user,
NewEmail);
}
} }
} }
else // New email is not valid else // New email is not valid
{ Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_email_address_entered_X_is_not_valid,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; NewEmail);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_email_address_entered_X_is_not_valid,
NewEmail);
}
} }
else else
{ Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
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);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1698,25 +1661,19 @@ bool Mai_SendMailMsgToConfirmEmail (void)
{ {
case 0: // Message sent successfully case 0: // Message sent successfully
Gbl.Usrs.Me.ConfirmEmailJustSent = true; Gbl.Usrs.Me.ConfirmEmailJustSent = true;
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Gbl.Usrs.Me.UsrDat.Email);
Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address,
Gbl.Usrs.Me.UsrDat.Email);
return true; return true;
case 1: case 1:
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; Txt_There_was_a_problem_sending_an_email_automatically);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_was_a_problem_sending_an_email_automatically,
Ale_MAX_BYTES_ALERT);
return false; return false;
default: default:
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,Mai_EMAIL_SECTION_ID,
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID; "Internal error: an email message has not been sent successfully."
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), " Error code returned by the script: %d",
"Internal error: an email message has not been sent successfully." ReturnCode);
" Error code returned by the script: %d",
ReturnCode);
return false; return false;
} }
} }

View File

@ -304,7 +304,6 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
{ {
extern const char *Txt_There_are_more_than_one_table_in_the_file_of_marks; extern const char *Txt_There_are_more_than_one_table_in_the_file_of_marks;
extern const char *Txt_Table_not_found_in_the_file_of_marks; extern const char *Txt_Table_not_found_in_the_file_of_marks;
// extern const char *Txt_X_header_rows_Y_student_rows_and_Z_footer_rows_found;
char CellContent[Mrk_MAX_BYTES_IN_CELL_CONTENT + 1]; char CellContent[Mrk_MAX_BYTES_IN_CELL_CONTENT + 1];
FILE *FileAllMarks; FILE *FileAllMarks;
bool EndOfHead = false; bool EndOfHead = false;
@ -326,9 +325,8 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
// Only one table is allowed // Only one table is allowed
if (Str_FindStrInFile (FileAllMarks,"<table",Str_NO_SKIP_HTML_COMMENTS)) if (Str_FindStrInFile (FileAllMarks,"<table",Str_NO_SKIP_HTML_COMMENTS))
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_are_more_than_one_table_in_the_file_of_marks, Txt_There_are_more_than_one_table_in_the_file_of_marks);
Ale_MAX_BYTES_ALERT);
FileIsCorrect = false; FileIsCorrect = false;
} }
else else
@ -389,21 +387,14 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
} }
else else
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Table_not_found_in_the_file_of_marks, Txt_Table_not_found_in_the_file_of_marks);
Ale_MAX_BYTES_ALERT);
FileIsCorrect = false; FileIsCorrect = false;
} }
/***** The file of marks is no more necessary. Close it. *****/ /***** The file of marks is no more necessary. Close it. *****/
fclose (FileAllMarks); fclose (FileAllMarks);
} }
/*
if (FileIsCorrect)
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_X_header_rows_Y_student_rows_and_Z_footer_rows_found,
Marks->Header,NumRowsStds,Marks->Footer);
*/
return FileIsCorrect; return FileIsCorrect;
} }
@ -464,9 +455,8 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
/***** Open HTML file with the table of marks *****/ /***** Open HTML file with the table of marks *****/
if (!(FileAllMarks = fopen (PathFileAllMarks,"rb"))) if (!(FileAllMarks = fopen (PathFileAllMarks,"rb")))
{ // Can't open the file with the table of marks { // Can't open the file with the table of marks
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,"Can not open file of marks.", "Can not open file of marks.");
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
@ -601,10 +591,9 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
/***** User's ID not found in table *****/ /***** User's ID not found in table *****/
fclose (FileAllMarks); fclose (FileAllMarks);
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,NULL,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_THE_USER_X_is_not_found_in_the_file_of_marks,
Txt_THE_USER_X_is_not_found_in_the_file_of_marks, UsrDat->FullName);
UsrDat->FullName);
return false; return false;
} }
@ -714,7 +703,7 @@ void Mrk_ShowMyMarks (void)
else // Problems in table of marks or user's ID not found else // Problems in table of marks or user's ID not found
{ {
fclose (FileUsrMarks); fclose (FileUsrMarks);
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
unlink (FileNameUsrMarks); // File with marks is no longer necessary unlink (FileNameUsrMarks); // File with marks is no longer necessary
@ -874,28 +863,23 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
{ {
fclose (FileUsrMarks); fclose (FileUsrMarks);
if (asprintf (ContentStr,"<![CDATA[%s]]>", if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.DelayedAlert.Txt) < 0) Ale_GetTextOfLastAlert ()) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
Ale_ResetAllAlerts ();
} }
} }
else else
{ {
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]]>", if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.DelayedAlert.Txt) < 0) "Can not open file of marks.") < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
} }
unlink (FileNameUsrMarks); // File with marks is no longer necessary unlink (FileNameUsrMarks); // File with marks is no longer necessary
} }
else else
{ {
Gbl.DelayedAlert.Type = Ale_ERROR;
Str_Copy (Gbl.DelayedAlert.Txt,"User's IDs not found!",
Ale_MAX_BYTES_ALERT);
if (asprintf (ContentStr,"<![CDATA[%s]]>", if (asprintf (ContentStr,"<![CDATA[%s]]>",
Gbl.DelayedAlert.Txt) < 0) "User's IDs not found!") < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
} }
} }

View File

@ -250,9 +250,8 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
Box_StartBox (StrRecordWidth,Txt_Nickname,Acc_PutLinkToRemoveMyAccount, Box_StartBox (StrRecordWidth,Txt_Nickname,Acc_PutLinkToRemoveMyAccount,
Hlp_PROFILE_Account,Box_NOT_CLOSABLE); Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show possible alert *****/ /***** Show possible alerts *****/
if (Gbl.DelayedAlert.Section == (const char *) Nck_NICKNAME_SECTION_ID) Ale_ShowAlerts (Nck_NICKNAME_SECTION_ID);
Ale_ShowDelayedAlert ();
/***** Help message *****/ /***** Help message *****/
if (IMustFillNickname) if (IMustFillNickname)
@ -434,19 +433,13 @@ void Nck_RemoveMyNick (void)
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NicknameWithoutArroba); Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NicknameWithoutArroba);
/***** Show message *****/ /***** Show message *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; Txt_Nickname_X_removed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NicknameWithoutArroba);
Txt_Nickname_X_removed,
NicknameWithoutArroba);
} }
else else
{ Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_can_not_delete_your_current_nickname);
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_your_current_nickname,
Ale_MAX_BYTES_ALERT);
}
/***** Show my account again *****/ /***** Show my account again *****/
Acc_ShowFormChgMyAccount (); Acc_ShowFormChgMyAccount ();
@ -474,20 +467,18 @@ void Nck_RemoveOtherUsrNick (void)
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NicknameWithoutArroba); Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NicknameWithoutArroba);
/***** Show message *****/ /***** Show message *****/
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; Txt_Nickname_X_removed,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NicknameWithoutArroba);
Txt_Nickname_X_removed,
NicknameWithoutArroba);
/***** Show user's account again *****/ /***** Show user's account again *****/
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -534,10 +525,10 @@ void Nck_UpdateOtherUsrNick (void)
Acc_ShowFormChgOtherUsrAccount (); Acc_ShowFormChgOtherUsrAccount ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -565,13 +556,9 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
/***** Check if new nickname exists in database *****/ /***** Check if new nickname exists in database *****/
if (!strcmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname match exactly the new nickname if (!strcmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname match exactly the new nickname
{ Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; NewNicknameWithoutArroba);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
NewNicknameWithoutArroba);
}
else if (strcasecmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname does not match, not even case insensitive, the new nickname else if (strcasecmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname does not match, not even case insensitive, the new nickname
{ {
/***** Check if the new nickname matches any of my old nicknames *****/ /***** Check if the new nickname matches any of my old nicknames *****/
@ -584,15 +571,11 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
"SELECT COUNT(*) FROM usr_nicknames" "SELECT COUNT(*) FROM usr_nicknames"
" WHERE Nickname='%s' AND UsrCod<>%ld", " WHERE Nickname='%s' AND UsrCod<>%ld",
NewNicknameWithoutArroba,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname NewNicknameWithoutArroba,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname
{ Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_nickname_X_had_been_registered_by_another_user,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; NewNicknameWithoutArroba);
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
Txt_The_nickname_X_had_been_registered_by_another_user,
NewNicknameWithoutArroba);
}
} }
if (Gbl.DelayedAlert.Type == Ale_NONE) if (Ale_GetNumAlerts () == 0) // No problems
{ {
// Now we know the new nickname is not already in database // Now we know the new nickname is not already in database
// and is diffent to the current one // and is diffent to the current one
@ -600,23 +583,17 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
Str_Copy (UsrDat->Nickname,NewNicknameWithoutArroba, Str_Copy (UsrDat->Nickname,NewNicknameWithoutArroba,
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA); Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; Txt_The_nickname_X_has_been_registered_successfully,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), NewNicknameWithoutArroba);
Txt_The_nickname_X_has_been_registered_successfully,
NewNicknameWithoutArroba);
} }
} }
else // New nickname is not valid else // New nickname is not valid
{ Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_The_nickname_entered_X_is_not_valid_,
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID; NewNicknameWithArroba,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
Txt_The_nickname_entered_X_is_not_valid_, Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
NewNicknameWithArroba,
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -178,12 +178,8 @@ void Pwd_UpdateMyPwd (void)
/***** Check and update new password *****/ /***** Check and update new password *****/
Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Me.UsrDat); Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Me.UsrDat);
else else
{ Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Type = Ale_WARNING; Txt_You_have_not_entered_your_password_correctly);
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_entered_your_password_correctly,
Ale_MAX_BYTES_ALERT);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -199,10 +195,10 @@ void Pwd_UpdateOtherUsrPwd (void)
/***** Check and update password *****/ /***** Check and update password *****/
Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Other.UsrDat); Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Other.UsrDat);
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -221,13 +217,9 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat)
/***** Check if I have written twice the same password *****/ /***** Check if I have written twice the same password *****/
if (strcmp (NewPlainPassword[0],NewPlainPassword[1])) if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
{
// Passwords don't match // Passwords don't match
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_You_have_not_written_twice_the_same_new_password);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_written_twice_the_same_new_password,
Ale_MAX_BYTES_ALERT);
}
else else
{ {
Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword); Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword);
@ -241,10 +233,8 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat)
Ses_UpdateSessionDataInDB (); Ses_UpdateSessionDataInDB ();
Enr_UpdateUsrData (UsrDat); Enr_UpdateUsrData (UsrDat);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_has_been_changed_successfully);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_has_been_changed_successfully,
Ale_MAX_BYTES_ALERT);
} }
} }
} }
@ -525,10 +515,8 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
/***** Check if password is found in user's ID, first name or surnames of anybody *****/ /***** Check if password is found in user's ID, first name or surnames of anybody *****/
if (Pwd_CheckIfPasswdIsUsrIDorName (PlainPassword)) // PlainPassword is a user's ID, name or surname if (Pwd_CheckIfPasswdIsUsrIDorName (PlainPassword)) // PlainPassword is a user's ID, name or surname
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_is_too_trivial_);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_is_too_trivial_,
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
@ -536,10 +524,8 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
if (Pwd_GetNumOtherUsrsWhoUseThisPassword (EncryptedPassword,UsrCod) > if (Pwd_GetNumOtherUsrsWhoUseThisPassword (EncryptedPassword,UsrCod) >
Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD) Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD)
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_is_too_trivial_);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_is_too_trivial_,
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
@ -620,21 +606,17 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
/***** Check length of password *****/ /***** Check length of password *****/
if (LengthPassword < Pwd_MIN_BYTES_PLAIN_PASSWORD) // PlainPassword too short if (LengthPassword < Pwd_MIN_BYTES_PLAIN_PASSWORD) // PlainPassword too short
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_must_be_at_least_X_characters,
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Pwd_MIN_CHARS_PLAIN_PASSWORD);
Txt_The_password_must_be_at_least_X_characters,
Pwd_MIN_CHARS_PLAIN_PASSWORD);
return false; return false;
} }
/***** Check spaces in password *****/ /***** Check spaces in password *****/
if (strchr (PlainPassword,(int) ' ') != NULL) // PlainPassword with spaces if (strchr (PlainPassword,(int) ' ') != NULL) // PlainPassword with spaces
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_can_not_contain_spaces);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_can_not_contain_spaces,
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
@ -646,10 +628,8 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
ItsANumber = false; ItsANumber = false;
if (ItsANumber) if (ItsANumber)
{ {
Gbl.DelayedAlert.Type = Ale_WARNING; Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID; Txt_The_password_can_not_consist_only_of_digits);
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_can_not_consist_only_of_digits,
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
@ -687,9 +667,8 @@ void Pwd_ShowFormChgMyPwd (void)
Box_StartBox (StrRecordWidth,Txt_Password,NULL, Box_StartBox (StrRecordWidth,Txt_Password,NULL,
Hlp_PROFILE_Password,Box_NOT_CLOSABLE); Hlp_PROFILE_Password,Box_NOT_CLOSABLE);
/***** Show possible alert *****/ /***** Show possible alerts *****/
if (Gbl.DelayedAlert.Section == Pwd_PASSWORD_SECTION_ID) Ale_ShowAlerts (Pwd_PASSWORD_SECTION_ID);
Ale_ShowDelayedAlert ();
/***** Help message *****/ /***** Help message *****/
if (!IHaveAPasswordInDB) // If I don't have a password in database... if (!IHaveAPasswordInDB) // If I don't have a password in database...
@ -851,9 +830,8 @@ void Pwd_ShowFormChgOtherUsrPwd (void)
/***** Start section *****/ /***** Start section *****/
Lay_StartSection (Pwd_PASSWORD_SECTION_ID); Lay_StartSection (Pwd_PASSWORD_SECTION_ID);
/***** Show possible alert *****/ /***** Show possible alerts *****/
if (Gbl.DelayedAlert.Section == (const char *) Pwd_PASSWORD_SECTION_ID) Ale_ShowAlerts (Pwd_PASSWORD_SECTION_ID);
Ale_ShowDelayedAlert ();
/***** Form to change password *****/ /***** Form to change password *****/
/* Start form */ /* Start form */

View File

@ -373,10 +373,10 @@ void Pho_SendPhotoUsr (void)
Pho_ReqOtherUsrPhoto (); Pho_ReqOtherUsrPhoto ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else // User not found else // User not found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -413,7 +413,7 @@ void Pho_RecOtherUsrPhotoDetFaces (void)
Rec_ShowPublicSharedRecordOtherUsr (); Rec_ShowPublicSharedRecordOtherUsr ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -464,7 +464,7 @@ void Pho_RemoveMyPhoto1 (void)
void Pho_RemoveMyPhoto2 (void) void Pho_RemoveMyPhoto2 (void)
{ {
/***** Write success / warning message *****/ /***** Write success / warning message *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Show my record and other data *****/ /***** Show my record and other data *****/
Rec_ShowMySharedRecordAndMore (); Rec_ShowMySharedRecordAndMore ();
@ -525,10 +525,10 @@ void Pho_ReqRemoveUsrPhoto (void)
Ale_ShowAlert (Ale_INFO,Txt_The_photo_no_longer_exists); Ale_ShowAlert (Ale_INFO,Txt_The_photo_no_longer_exists);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/***** Show another user's record card *****/ /***** Show another user's record card *****/
Rec_ShowPublicSharedRecordOtherUsr (); Rec_ShowPublicSharedRecordOtherUsr ();
@ -548,10 +548,10 @@ void Pho_RemoveUsrPhoto (void)
{ {
/***** Remove photo *****/ /***** Remove photo *****/
if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat)) if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat))
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/***** Show another user's record card *****/ /***** Show another user's record card *****/
Rec_ShowPublicSharedRecordOtherUsr (); Rec_ShowPublicSharedRecordOtherUsr ();
@ -843,7 +843,7 @@ void Pho_UpdateUsrPhoto1 (void)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
Pho_UpdatePhoto1 (&Gbl.Usrs.Other.UsrDat); Pho_UpdatePhoto1 (&Gbl.Usrs.Other.UsrDat);
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
void Pho_UpdateUsrPhoto2 (void) void Pho_UpdateUsrPhoto2 (void)
@ -886,16 +886,12 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat)
/* Remove the user from the list of users without photo */ /* Remove the user from the list of users without photo */
Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod); Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_has_been_updated, Txt_Photo_has_been_updated);
Ale_MAX_BYTES_ALERT);
} }
else else
{ Ale_CreateAlert (Ale_ERROR,NULL,
Gbl.DelayedAlert.Type = Ale_ERROR; "Error updating photo.");
Str_Copy (Gbl.DelayedAlert.Txt,"Error updating photo.",
Ale_MAX_BYTES_ALERT);
}
} }
static void Pho_UpdatePhoto2 (void) static void Pho_UpdatePhoto2 (void)
@ -904,7 +900,7 @@ static void Pho_UpdatePhoto2 (void)
unsigned NumPhoto; unsigned NumPhoto;
/***** Start alert *****/ /***** Start alert *****/
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt); Ale_ShowLastAlertAndButton1 ();
/***** Show the three images resulting of the processing *****/ /***** Show the three images resulting of the processing *****/
Tbl_StartTableWide (0); Tbl_StartTableWide (0);
@ -1126,16 +1122,14 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
if (NumErrors) if (NumErrors)
{ {
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,"Error removing photo.", "Error removing photo.");
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
else else
{ {
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_removed, Txt_Photo_removed);
Ale_MAX_BYTES_ALERT);
return true; return true;
} }
} }

View File

@ -254,7 +254,7 @@ void Prf_GetUsrDatAndShowUserProfile (void)
if (!ProfileShown) if (!ProfileShown)
{ {
/* Show error message */ /* Show error message */
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/* Request a user's profile */ /* Request a user's profile */
Prf_RequestUserProfile (); Prf_RequestUserProfile ();

View File

@ -1976,7 +1976,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
Usr_FreeListUsrCods (&ListUsrCods); Usr_FreeListUsrCods (&ListUsrCods);
} }
else // No users found else // No users found
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/***** Put form to edit project again *****/ /***** Put form to edit project again *****/
Prj_RequestCreatOrEditPrj (PrjCod); Prj_RequestCreatOrEditPrj (PrjCod);
@ -2058,10 +2058,10 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -2133,10 +2133,10 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
Prj.Title); Prj.Title);
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);

View File

@ -1029,7 +1029,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
/* Show optional alert */ /* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/* Shared record */ /* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">"); fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1097,7 +1097,7 @@ static void Rec_ShowRecordOneStdCrs (void)
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Show optional alert (result of editing data in course record) *****/ /***** Show optional alert (result of editing data in course record) *****/
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/***** Start container for this user *****/ /***** Start container for this user *****/
fprintf (Gbl.F.Out,"<div class=\"REC_USR\">"); fprintf (Gbl.F.Out,"<div class=\"REC_USR\">");
@ -1236,7 +1236,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Show optional alert */ /* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/* Shared record */ /* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">"); fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1463,7 +1463,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
/* Show optional alert */ /* Show optional alert */
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
Ale_ShowDelayedAlert (); Ale_ShowAlerts (NULL);
/* Shared record */ /* Shared record */
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">"); fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
@ -1628,9 +1628,6 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
extern const char *Txt_Student_record_card_in_this_course_has_been_updated; extern const char *Txt_Student_record_card_in_this_course_has_been_updated;
long OriginalActCod; long OriginalActCod;
/***** Initialize alert type *****/
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
/***** Get where we came from *****/ /***** Get where we came from *****/
OriginalActCod = Par_GetParToLong ("OriginalActCod"); OriginalActCod = Par_GetParToLong ("OriginalActCod");
Gbl.Action.Original = Act_GetActionFromActCod (OriginalActCod); Gbl.Action.Original = Act_GetActionFromActCod (OriginalActCod);
@ -1650,9 +1647,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
/***** Update the record *****/ /***** Update the record *****/
Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod); Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod);
Gbl.DelayedAlert.Type = Ale_SUCCESS; Ale_CreateAlert (Ale_SUCCESS,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Student_record_card_in_this_course_has_been_updated, Txt_Student_record_card_in_this_course_has_been_updated);
Ale_MAX_BYTES_ALERT);
/***** Show one or multiple records *****/ /***** Show one or multiple records *****/
switch (Gbl.Action.Original) switch (Gbl.Action.Original)

View File

@ -846,11 +846,17 @@ static void Soc_BuildQueryToGetTimeline (char **Query,
Soc_AddNotesJustRetrievedToTimelineThisSession (); Soc_AddNotesJustRetrievedToTimelineThisSession ();
/***** Build query to show timeline including the users I am following *****/ /***** Build query to show timeline including the users I am following *****/
DB_BuildQuery_old (Query, DB_BuildQuery (Query,
"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)" "SELECT PubCod," // row[0]
" FROM social_pubs WHERE PubCod IN " "NotCod," // row[1]
"(SELECT PubCod FROM pub_codes)" "PublisherCod," // row[2]
" ORDER BY PubCod DESC"); "PubType," // row[3]
"UNIX_TIMESTAMP(TimePublish)" // row[4]
" FROM social_pubs"
" WHERE PubCod IN "
"(SELECT PubCod"
" FROM pub_codes)"
" ORDER BY PubCod DESC");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2708,7 +2708,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
/****** Convert invalid characters in a file name to valid characters ********/ /****** Convert invalid characters in a file name to valid characters ********/
/*****************************************************************************/ /*****************************************************************************/
// Return true if the name of the file o folder is valid // Return true if the name of the file o folder is valid
// If the name is not valid, Gbl.DelayedAlert.Txt will contain feedback text // If the name is not valid, an alert will contain feedback text
// File names with heading and trailing spaces are allowed // File names with heading and trailing spaces are allowed
bool Str_ConvertFilFolLnkNameToValid (char *FileName) bool Str_ConvertFilFolLnkNameToValid (char *FileName)
@ -2799,22 +2799,15 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName)
if (NumAlfanum) if (NumAlfanum)
FileNameIsOK = true; FileNameIsOK = true;
else else
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_X_invalid_name_NO_HTML :
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt), Txt_UPLOAD_FILE_X_invalid_name,
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_X_invalid_name_NO_HTML : FileName);
Txt_UPLOAD_FILE_X_invalid_name,
FileName);
}
} }
else // FileName is empty else // FileName is empty
{ Ale_CreateAlert (Ale_WARNING,NULL,
Gbl.DelayedAlert.Type = Ale_WARNING; Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML :
Str_Copy (Gbl.DelayedAlert.Txt, Txt_UPLOAD_FILE_Invalid_name);
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML :
Txt_UPLOAD_FILE_Invalid_name,
Ale_MAX_BYTES_ALERT);
}
return FileNameIsOK; return FileNameIsOK;
} }

View File

@ -2645,7 +2645,8 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
if (NumAnswers > Svy_MAX_ANSWERS_PER_QUESTION) if (NumAnswers > Svy_MAX_ANSWERS_PER_QUESTION)
Lay_ShowErrorAndExit ("Wrong answer."); Lay_ShowErrorAndExit ("Wrong answer.");
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns)) if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2], Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
Svy_MAX_BYTES_ANSWER); Svy_MAX_BYTES_ANSWER);
@ -2883,9 +2884,8 @@ static bool Svy_AllocateTextChoiceAnswer (struct SurveyQuestion *SvyQst,
Svy_FreeTextChoiceAnswer (SvyQst,NumAns); Svy_FreeTextChoiceAnswer (SvyQst,NumAns);
if ((SvyQst->AnsChoice[NumAns].Text = (char *) malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL) if ((SvyQst->AnsChoice[NumAns].Text = (char *) malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL)
{ {
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.", "Not enough memory to store answer.");
Ale_MAX_BYTES_ALERT);
return false; return false;
} }
SvyQst->AnsChoice[NumAns].Text[0] = '\0'; SvyQst->AnsChoice[NumAns].Text[0] = '\0';
@ -2965,7 +2965,8 @@ void Svy_ReceiveQst (void)
NumAns++) NumAns++)
{ {
if (!Svy_AllocateTextChoiceAnswer (&SvyQst,NumAns)) if (!Svy_AllocateTextChoiceAnswer (&SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
snprintf (AnsStr,sizeof (AnsStr), snprintf (AnsStr,sizeof (AnsStr),
"AnsStr%u", "AnsStr%u",
NumAns); NumAns);
@ -3396,7 +3397,9 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
/* Convert the answer (row[2]), that is in HTML, to rigorous HTML */ /* Convert the answer (row[2]), that is in HTML, to rigorous HTML */
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns)) if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2], Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
Svy_MAX_BYTES_ANSWER); Svy_MAX_BYTES_ANSWER);
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,

View File

@ -3724,7 +3724,8 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
/***** Allocate memory for text in this choice answer *****/ /***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
/***** Assign index (row[0]). /***** Assign index (row[0]).
Index is 0,1,2,3... if no shuffle Index is 0,1,2,3... if no shuffle
@ -3845,7 +3846,8 @@ static void Tst_WriteChoiceAnsAssessTest (struct UsrData *UsrDat,
/***** Allocate memory for text in this choice option *****/ /***** Allocate memory for text in this choice option *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
/***** Copy answer text (row[1]) and convert it, /***** Copy answer text (row[1]) and convert it,
that is in HTML, to rigorous HTML ******/ that is in HTML, to rigorous HTML ******/
@ -4095,7 +4097,8 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
/***** Allocate memory for text in this choice answer *****/ /***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
/***** Assign index (row[0]). /***** Assign index (row[0]).
Index is 0,1,2,3... if no shuffle Index is 0,1,2,3... if no shuffle
@ -4209,7 +4212,8 @@ static void Tst_WriteTextAnsAssessTest (struct UsrData *UsrDat,
/***** Allocate memory for text in this choice answer *****/ /***** Allocate memory for text in this choice answer *****/
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
/***** Copy answer text (row[1]) and convert it, that is in HTML, to rigorous HTML ******/ /***** 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], Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1],
@ -5444,17 +5448,15 @@ int Tst_AllocateTextChoiceAnswer (unsigned NumOpt)
if ((Gbl.Test.Answer.Options[NumOpt].Text = if ((Gbl.Test.Answer.Options[NumOpt].Text =
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL) (char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{ {
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.", "Not enough memory to store answer.");
Ale_MAX_BYTES_ALERT);
return 0; return 0;
} }
if ((Gbl.Test.Answer.Options[NumOpt].Feedback = if ((Gbl.Test.Answer.Options[NumOpt].Feedback =
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL) (char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{ {
Gbl.DelayedAlert.Type = Ale_ERROR; Ale_CreateAlert (Ale_ERROR,NULL,
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store feedback.", "Not enough memory to store feedback.");
Ale_MAX_BYTES_ALERT);
return 0; return 0;
} }
@ -5640,7 +5642,8 @@ static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
if (Gbl.Test.Answer.NumOptions > Tst_MAX_OPTIONS_PER_QUESTION) if (Gbl.Test.Answer.NumOptions > Tst_MAX_OPTIONS_PER_QUESTION)
Lay_ShowErrorAndExit ("Wrong answer."); Lay_ShowErrorAndExit ("Wrong answer.");
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1], Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK); Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
@ -5858,18 +5861,23 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
{ {
case Tst_ANS_INT: case Tst_ANS_INT:
if (!Tst_AllocateTextChoiceAnswer (0)) if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Par_GetParToText ("AnsInt",Gbl.Test.Answer.Options[0].Text,1 + 10); Par_GetParToText ("AnsInt",Gbl.Test.Answer.Options[0].Text,1 + 10);
break; break;
case Tst_ANS_FLOAT: case Tst_ANS_FLOAT:
if (!Tst_AllocateTextChoiceAnswer (0)) if (!Tst_AllocateTextChoiceAnswer (0))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Par_GetParToText ("AnsFloatMin",Gbl.Test.Answer.Options[0].Text, Par_GetParToText ("AnsFloatMin",Gbl.Test.Answer.Options[0].Text,
Tst_MAX_BYTES_FLOAT_ANSWER); Tst_MAX_BYTES_FLOAT_ANSWER);
if (!Tst_AllocateTextChoiceAnswer (1)) if (!Tst_AllocateTextChoiceAnswer (1))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text, Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text,
Tst_MAX_BYTES_FLOAT_ANSWER); Tst_MAX_BYTES_FLOAT_ANSWER);
break; break;
@ -5890,7 +5898,8 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
NumOpt++) NumOpt++)
{ {
if (!Tst_AllocateTextChoiceAnswer (NumOpt)) if (!Tst_AllocateTextChoiceAnswer (NumOpt))
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); /* Abort on error */
Ale_ShowAlertsAndExit ();
/* Get answer */ /* Get answer */
snprintf (AnsStr,sizeof (AnsStr), snprintf (AnsStr,sizeof (AnsStr),
@ -6267,31 +6276,24 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
"SELECT TagCod FROM tst_tags" "SELECT TagCod FROM tst_tags"
" WHERE CrsCod=%ld AND TagTxt='%s'", " WHERE CrsCod=%ld AND TagTxt='%s'",
Gbl.CurrentCrs.Crs.CrsCod,TagTxt); Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
Gbl.DelayedAlert.Type = Ale_NONE;
if (NumRows == 1) if (NumRows == 1)
{ {
/***** Get tag code *****/ /***** Get tag code *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0) if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
{ Ale_CreateAlert (Ale_ERROR,NULL,
Gbl.DelayedAlert.Type = Ale_ERROR; "Wrong code of tag.");
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong code of tag.",
Ale_MAX_BYTES_ALERT);
}
} }
else if (NumRows > 1) else if (NumRows > 1)
{ Ale_CreateAlert (Ale_ERROR,NULL,
Gbl.DelayedAlert.Type = Ale_ERROR; "Duplicated tag.");
Str_Copy (Gbl.DelayedAlert.Txt,"Duplicated tag.",
Ale_MAX_BYTES_ALERT);
}
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
if (Gbl.DelayedAlert.Type == Ale_ERROR) /***** Abort on error *****/
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt); if (Ale_GetTypeOfLastAlert () == Ale_ERROR)
Ale_ShowAlertsAndExit ();
return TagCod; return TagCod;
} }

View File

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

View File

@ -2957,7 +2957,7 @@ void Usr_ChkUsrAndGetUsrData (void)
/* Send message via email to confirm the new email address */ /* Send message via email to confirm the new email address */
Mai_SendMailMsgToConfirmEmail (); Mai_SendMailMsgToConfirmEmail ();
Ale_ShowDelayedAlert (); // Show alert after sending email confirmation Ale_ShowAlerts (NULL); // Show alert after sending email confirmation
} }
} }
else // Gbl.Action.Act != ActCreUsrAcc else // Gbl.Action.Act != ActCreUsrAcc
@ -4513,96 +4513,96 @@ void Usr_GetListUsrs (Sco_Scope_t Scope,Rol_Role_t Role)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
/* Get users in courses from the whole platform */ /* Get users in courses from the whole platform */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM usr_data,crs_usr" " FROM usr_data,crs_usr"
" WHERE usr_data.UsrCod=crs_usr.UsrCod" " WHERE usr_data.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" ORDER BY " " ORDER BY "
"usr_data.Surname1," "usr_data.Surname1,"
"usr_data.Surname2," "usr_data.Surname2,"
"usr_data.FirstName," "usr_data.FirstName,"
"usr_data.UsrCod", "usr_data.UsrCod",
QueryFields, QueryFields,
(unsigned) Role); (unsigned) Role);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
/* Get users in courses from the current country */ /* Get users in courses from the current country */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM usr_data,crs_usr,courses,degrees,centres,institutions" " FROM usr_data,crs_usr,courses,degrees,centres,institutions"
" WHERE usr_data.UsrCod=crs_usr.UsrCod" " WHERE usr_data.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=institutions.InsCod" " AND centres.InsCod=institutions.InsCod"
" AND institutions.CtyCod=%ld" " AND institutions.CtyCod=%ld"
" ORDER BY " " ORDER BY "
"usr_data.Surname1," "usr_data.Surname1,"
"usr_data.Surname2," "usr_data.Surname2,"
"usr_data.FirstName," "usr_data.FirstName,"
"usr_data.UsrCod", "usr_data.UsrCod",
QueryFields, QueryFields,
(unsigned) Role, (unsigned) Role,
Gbl.CurrentCty.Cty.CtyCod); Gbl.CurrentCty.Cty.CtyCod);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
/* Get users in courses from the current institution */ /* Get users in courses from the current institution */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM usr_data,crs_usr,courses,degrees,centres" " FROM usr_data,crs_usr,courses,degrees,centres"
" WHERE usr_data.UsrCod=crs_usr.UsrCod" " WHERE usr_data.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=%ld" " AND centres.InsCod=%ld"
" ORDER BY " " ORDER BY "
"usr_data.Surname1," "usr_data.Surname1,"
"usr_data.Surname2," "usr_data.Surname2,"
"usr_data.FirstName," "usr_data.FirstName,"
"usr_data.UsrCod", "usr_data.UsrCod",
QueryFields, QueryFields,
(unsigned) Role, (unsigned) Role,
Gbl.CurrentIns.Ins.InsCod); Gbl.CurrentIns.Ins.InsCod);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
/* Get users in courses from the current centre */ /* Get users in courses from the current centre */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM usr_data,crs_usr,courses,degrees" " FROM usr_data,crs_usr,courses,degrees"
" WHERE usr_data.UsrCod=crs_usr.UsrCod" " WHERE usr_data.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=%ld" " AND degrees.CtrCod=%ld"
" ORDER BY " " ORDER BY "
"usr_data.Surname1," "usr_data.Surname1,"
"usr_data.Surname2," "usr_data.Surname2,"
"usr_data.FirstName," "usr_data.FirstName,"
"usr_data.UsrCod", "usr_data.UsrCod",
QueryFields, QueryFields,
(unsigned) Role, (unsigned) Role,
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
/* Get users in courses from the current degree */ /* Get users in courses from the current degree */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM usr_data,crs_usr,courses" " FROM usr_data,crs_usr,courses"
" WHERE usr_data.UsrCod=crs_usr.UsrCod" " WHERE usr_data.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=%ld" " AND courses.DegCod=%ld"
" ORDER BY " " ORDER BY "
"usr_data.Surname1," "usr_data.Surname1,"
"usr_data.Surname2," "usr_data.Surname2,"
"usr_data.FirstName," "usr_data.FirstName,"
"usr_data.UsrCod", "usr_data.UsrCod",
QueryFields, QueryFields,
(unsigned) Role, (unsigned) Role,
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
/* Get users from the current course */ /* Get users from the current course */
@ -4673,81 +4673,81 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
/* Search users from the whole platform */ /* Search users from the whole platform */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,usr_data" " FROM candidate_users,usr_data"
" WHERE %s", " WHERE %s",
QueryFields,OrderQuery); QueryFields,OrderQuery);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
/* Search users in courses from the current country */ /* Search users in courses from the current country */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data" " FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=institutions.InsCod" " AND centres.InsCod=institutions.InsCod"
" AND institutions.CtyCod=%ld" " AND institutions.CtyCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
/* Search users in courses from the current institution */ /* Search users in courses from the current institution */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data" " FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=%ld" " AND centres.InsCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
/* Search users in courses from the current centre */ /* Search users in courses from the current centre */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,usr_data" " FROM candidate_users,crs_usr,courses,degrees,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=%ld" " AND degrees.CtrCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
/* Search users in courses from the current degree */ /* Search users in courses from the current degree */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,usr_data" " FROM candidate_users,crs_usr,courses,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=%ld" " AND courses.DegCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.DegCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
/* Search users in courses from the current course */ /* Search users in courses from the current course */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s,crs_usr.Role,crs_usr.Accepted" "SELECT %s,crs_usr.Role,crs_usr.Accepted"
" FROM candidate_users,crs_usr,usr_data" " FROM candidate_users,crs_usr,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
" AND crs_usr.CrsCod=%ld" " AND crs_usr.CrsCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
OrderQuery); OrderQuery);
break; break;
default: default:
Lay_WrongScopeExit (); Lay_WrongScopeExit ();
@ -4756,13 +4756,13 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
break; break;
case Rol_GST: // Guests (scope is not used) case Rol_GST: // Guests (scope is not used)
/* Search users with no courses */ /* Search users with no courses */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,usr_data" " FROM candidate_users,usr_data"
" WHERE candidate_users.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " WHERE candidate_users.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" AND %s", " AND %s",
QueryFields, QueryFields,
OrderQuery); OrderQuery);
break; break;
case Rol_STD: // Student case Rol_STD: // Student
case Rol_NET: // Non-editing teacher case Rol_NET: // Non-editing teacher
@ -4791,95 +4791,95 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
/* Search users in courses from the whole platform */ /* Search users in courses from the whole platform */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,usr_data" " FROM candidate_users,crs_usr,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
/* Search users in courses from the current country */ /* Search users in courses from the current country */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data" " FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=institutions.InsCod" " AND centres.InsCod=institutions.InsCod"
" AND institutions.CtyCod=%ld" " AND institutions.CtyCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
/* Search users in courses from the current institution */ /* Search users in courses from the current institution */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data" " FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=%ld" " AND centres.InsCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
/* Search users in courses from the current centre */ /* Search users in courses from the current centre */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,degrees,usr_data" " FROM candidate_users,crs_usr,courses,degrees,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=degrees.DegCod" " AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=%ld" " AND degrees.CtrCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
/* Search users in courses from the current degree */ /* Search users in courses from the current degree */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s" "SELECT %s"
" FROM candidate_users,crs_usr,courses,usr_data" " FROM candidate_users,crs_usr,courses,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND crs_usr.CrsCod=courses.CrsCod" " AND crs_usr.CrsCod=courses.CrsCod"
" AND courses.DegCod=%ld" " AND courses.DegCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.DegCod,
OrderQuery); OrderQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
/* Search users in courses from the current course */ /* Search users in courses from the current course */
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s,crs_usr.Role,crs_usr.Accepted" "SELECT %s,crs_usr.Role,crs_usr.Accepted"
" FROM candidate_users,crs_usr,usr_data" " FROM candidate_users,crs_usr,usr_data"
" WHERE candidate_users.UsrCod=crs_usr.UsrCod" " WHERE candidate_users.UsrCod=crs_usr.UsrCod"
"%s" "%s"
" AND crs_usr.CrsCod=%ld" " AND crs_usr.CrsCod=%ld"
" AND %s", " AND %s",
QueryFields, QueryFields,
SubQueryRole, SubQueryRole,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
OrderQuery); OrderQuery);
break; break;
default: default:
Lay_WrongScopeExit (); Lay_WrongScopeExit ();
@ -4975,123 +4975,123 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
switch (Scope) switch (Scope)
{ {
case Sco_SCOPE_SYS: // All admins case Sco_SCOPE_SYS: // All admins
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod IN " " WHERE UsrCod IN "
"(SELECT DISTINCT UsrCod FROM admin)" "(SELECT DISTINCT UsrCod FROM admin)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields); QueryFields);
break; break;
case Sco_SCOPE_CTY: // System admins case Sco_SCOPE_CTY: // System admins
// and admins of the institutions, centres and degrees in the current country // and admins of the institutions, centres and degrees in the current country
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod IN " " WHERE UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s')" " WHERE Scope='%s')"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,institutions" "(SELECT admin.UsrCod FROM admin,institutions"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=institutions.InsCod" " AND admin.Cod=institutions.InsCod"
" AND institutions.CtyCod=%ld)" " AND institutions.CtyCod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,centres,institutions" "(SELECT admin.UsrCod FROM admin,centres,institutions"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=centres.CtrCod" " AND admin.Cod=centres.CtrCod"
" AND centres.InsCod=institutions.InsCod" " AND centres.InsCod=institutions.InsCod"
" AND institutions.CtyCod=%ld)" " AND institutions.CtyCod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,degrees,centres,institutions" "(SELECT admin.UsrCod FROM admin,degrees,centres,institutions"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=degrees.DegCod" " AND admin.Cod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=institutions.InsCod" " AND centres.InsCod=institutions.InsCod"
" AND institutions.CtyCod=%ld)" " AND institutions.CtyCod=%ld)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Sco_ScopeDB[Sco_SCOPE_SYS], Sco_ScopeDB[Sco_SCOPE_SYS],
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentCty.Cty.CtyCod, Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentCty.Cty.CtyCod,
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCty.Cty.CtyCod, Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCty.Cty.CtyCod,
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCty.Cty.CtyCod); Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCty.Cty.CtyCod);
break; break;
case Sco_SCOPE_INS: // System admins, case Sco_SCOPE_INS: // System admins,
// admins of the current institution, // admins of the current institution,
// and admins of the centres and degrees in the current institution // and admins of the centres and degrees in the current institution
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod IN " " WHERE UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s')" " WHERE Scope='%s')"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,centres" "(SELECT admin.UsrCod FROM admin,centres"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=centres.CtrCod" " AND admin.Cod=centres.CtrCod"
" AND centres.InsCod=%ld)" " AND centres.InsCod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,degrees,centres" "(SELECT admin.UsrCod FROM admin,degrees,centres"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=degrees.DegCod" " AND admin.Cod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod" " AND degrees.CtrCod=centres.CtrCod"
" AND centres.InsCod=%ld)" " AND centres.InsCod=%ld)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Sco_ScopeDB[Sco_SCOPE_SYS], Sco_ScopeDB[Sco_SCOPE_SYS],
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod, Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentIns.Ins.InsCod, Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentIns.Ins.InsCod,
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentIns.Ins.InsCod); Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentIns.Ins.InsCod);
break; break;
case Sco_SCOPE_CTR: // System admins, case Sco_SCOPE_CTR: // System admins,
// admins of the current institution, // admins of the current institution,
// admins and the current centre, // admins and the current centre,
// and admins of the degrees in the current centre // and admins of the degrees in the current centre
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod IN " " WHERE UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s')" " WHERE Scope='%s')"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT admin.UsrCod FROM admin,degrees" "(SELECT admin.UsrCod FROM admin,degrees"
" WHERE admin.Scope='%s'" " WHERE admin.Scope='%s'"
" AND admin.Cod=degrees.DegCod" " AND admin.Cod=degrees.DegCod"
" AND degrees.CtrCod=%ld)" " AND degrees.CtrCod=%ld)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Sco_ScopeDB[Sco_SCOPE_SYS], Sco_ScopeDB[Sco_SCOPE_SYS],
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod, Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod, Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCtr.Ctr.CtrCod); Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCtr.Ctr.CtrCod);
break; break;
case Sco_SCOPE_DEG: // System admins case Sco_SCOPE_DEG: // System admins
// and admins of the current institution, centre or degree // and admins of the current institution, centre or degree
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod IN " " WHERE UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s')" " WHERE Scope='%s')"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" OR UsrCod IN " " OR UsrCod IN "
"(SELECT UsrCod FROM admin" "(SELECT UsrCod FROM admin"
" WHERE Scope='%s' AND Cod=%ld)" " WHERE Scope='%s' AND Cod=%ld)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Sco_ScopeDB[Sco_SCOPE_SYS], Sco_ScopeDB[Sco_SCOPE_SYS],
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod, Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod, Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentDeg.Deg.DegCod); Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentDeg.Deg.DegCod);
break; break;
default: // not aplicable default: // not aplicable
Lay_WrongScopeExit (); Lay_WrongScopeExit ();
@ -5139,39 +5139,39 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
switch (Scope) switch (Scope)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields); QueryFields);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE (CtyCod=%ld OR InsCtyCod=%ld)" " WHERE (CtyCod=%ld OR InsCtyCod=%ld)"
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentCty.Cty.CtyCod); Gbl.CurrentCty.Cty.CtyCod);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE InsCod=%ld" " WHERE InsCod=%ld"
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Gbl.CurrentIns.Ins.InsCod); Gbl.CurrentIns.Ins.InsCod);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM usr_data" "SELECT %s FROM usr_data"
" WHERE CtrCod=%ld" " WHERE CtrCod=%ld"
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod", " ORDER BY Surname1,Surname2,FirstName,UsrCod",
QueryFields, QueryFields,
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
break; break;
default: // not aplicable default: // not aplicable
return; return;
@ -5219,14 +5219,14 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod)
if (Usr_GetNumUsrsInCrssOfDeg (Rol_STD,DegCod)) if (Usr_GetNumUsrsInCrssOfDeg (Rol_STD,DegCod))
{ {
/***** Get the students in a degree from database *****/ /***** Get the students in a degree from database *****/
DB_BuildQuery_old (&Query, DB_BuildQuery (&Query,
"SELECT %s FROM courses,crs_usr,usr_data" "SELECT %s FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod=%ld" " WHERE courses.DegCod=%ld"
" AND courses.CrsCod=crs_usr.CrsCod" " AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod", " AND crs_usr.UsrCod=usr_data.UsrCod",
QueryFields, QueryFields,
DegCod,(unsigned) Rol_STD); DegCod,(unsigned) Rol_STD);
/***** Get list of students from database *****/ /***** Get list of students from database *****/
Usr_GetListUsrsFromQuery (Query,Rol_STD,Sco_SCOPE_DEG); Usr_GetListUsrsFromQuery (Query,Rol_STD,Sco_SCOPE_DEG);
@ -9119,7 +9119,7 @@ void Usr_PrintUsrQRCode (void)
Box_EndBox (); Box_EndBox ();
} }
else else
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (); Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
} }
/*****************************************************************************/ /*****************************************************************************/