mirror of https://github.com/acanas/swad-core.git
Version18.69
This commit is contained in:
parent
0b9bd947ac
commit
9ac17c016a
127
swad_ID.c
127
swad_ID.c
|
@ -588,9 +588,8 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
|
|||
unsigned NumID;
|
||||
Act_Action_t NextAction;
|
||||
|
||||
/***** Show possible alert *****/
|
||||
if (Gbl.DelayedAlert.Section == (const char *) ID_ID_SECTION_ID)
|
||||
Ale_ShowDelayedAlert ();
|
||||
/***** Show possible alerts *****/
|
||||
Ale_ShowAlerts (ID_ID_SECTION_ID);
|
||||
|
||||
/***** Help message *****/
|
||||
if (IShouldFillInID)
|
||||
|
@ -764,10 +763,10 @@ void ID_RemoveOtherUsrID (void)
|
|||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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_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];
|
||||
bool ICanRemove;
|
||||
|
||||
|
@ -804,27 +802,16 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
ID_RemoveUsrIDFromDB (UsrDat->UsrCod,UsrID);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_ID_X_removed,
|
||||
UsrID);
|
||||
Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
|
||||
Txt_ID_X_removed,
|
||||
UsrID);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_this_ID,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
|
||||
Txt_You_can_not_delete_this_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -876,7 +863,6 @@ void ID_NewMyUsrID (void)
|
|||
|
||||
void ID_NewOtherUsrID (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get other user's code from form and get user's data *****/
|
||||
|
@ -895,10 +881,10 @@ void ID_NewOtherUsrID (void)
|
|||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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_The_ID_X_has_been_registered_successfully;
|
||||
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];
|
||||
unsigned NumID;
|
||||
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 (ItsMe || UsrDat->IDs.List[NumIDFound].Confirmed)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_matches_one_of_the_existing,
|
||||
NewID);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
|
||||
Txt_The_ID_X_matches_one_of_the_existing,
|
||||
NewID);
|
||||
else // It's not me && !Confirmed
|
||||
{
|
||||
/***** Mark this ID as confirmed *****/
|
||||
ID_ConfirmUsrID (UsrDat,NewID);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_has_been_confirmed,
|
||||
NewID);
|
||||
Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
|
||||
Txt_The_ID_X_has_been_confirmed,
|
||||
NewID);
|
||||
}
|
||||
}
|
||||
else if (UsrDat->IDs.Num >= ID_MAX_IDS_PER_USER)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_A_user_can_not_have_more_than_X_IDs,
|
||||
ID_MAX_IDS_PER_USER);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
|
||||
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
|
||||
{
|
||||
/***** Save this new ID *****/
|
||||
|
@ -975,29 +950,18 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
// Not me ==> ID confirmed
|
||||
ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_has_been_registered_successfully,
|
||||
NewID);
|
||||
Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
|
||||
Txt_The_ID_X_has_been_registered_successfully,
|
||||
NewID);
|
||||
}
|
||||
}
|
||||
else // New ID is not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_is_not_valid,
|
||||
NewID);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,ID_ID_SECTION_ID,
|
||||
Txt_The_ID_X_is_not_valid,
|
||||
NewID);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1025,7 +989,6 @@ void ID_ConfirmOtherUsrID (void)
|
|||
{
|
||||
extern const char *Txt_ID_X_had_already_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;
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
bool ICanConfirm;
|
||||
|
@ -1068,14 +1031,10 @@ void ID_ConfirmOtherUsrID (void)
|
|||
if (Found) // Found
|
||||
{
|
||||
if (Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed)
|
||||
{
|
||||
/***** ID found and already confirmed *****/
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_ID_X_had_already_been_confirmed,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,ID_ID_SECTION_ID,
|
||||
Txt_ID_X_had_already_been_confirmed,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
else
|
||||
{
|
||||
/***** Mark this ID as confirmed *****/
|
||||
|
@ -1084,28 +1043,16 @@ void ID_ConfirmOtherUsrID (void)
|
|||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed = true;
|
||||
|
||||
/***** Write success message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = ID_ID_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_has_been_confirmed,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
Ale_CreateAlert (Ale_SUCCESS,ID_ID_SECTION_ID,
|
||||
Txt_The_ID_X_has_been_confirmed,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
}
|
||||
}
|
||||
else // User's ID not found
|
||||
{
|
||||
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);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else // I can not confirm
|
||||
{
|
||||
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);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Show one or multiple records *****/
|
||||
switch (Gbl.Action.Original)
|
||||
|
@ -1124,7 +1071,7 @@ void ID_ConfirmOtherUsrID (void)
|
|||
break;
|
||||
default:
|
||||
/* Show optional alert */
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/* Show only the updated record of this user */
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,
|
||||
|
|
|
@ -520,10 +520,10 @@ void Acc_ShowFormChgOtherUsrAccount (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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?
|
||||
{
|
||||
Error = true;
|
||||
Ale_ShowDelayedAlert (); // Error message is set in Pwd_SlowCheckIfPasswordIsGood
|
||||
Ale_ShowAlerts (NULL); // Error message is set in Pwd_SlowCheckIfPasswordIsGood
|
||||
}
|
||||
|
||||
return !Error;
|
||||
|
@ -857,7 +857,7 @@ void Acc_GetUsrCodAndRemUsrGbl (void)
|
|||
Error = true;
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -373,7 +373,7 @@ void Agd_ShowUsrAgenda (void)
|
|||
}
|
||||
|
||||
if (Error)
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -416,7 +416,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
|
|||
Box_EndBox ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
/* The current language is not my preferred language
|
||||
|
|
193
swad_alert.c
193
swad_alert.c
|
@ -68,31 +68,164 @@ static const char *Ale_AlertIcons[Ale_NUM_ALERT_TYPES] =
|
|||
/***************************** 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_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
|
||||
Gbl.DelayedAlert.Section = NULL;
|
||||
Gbl.DelayedAlert.Txt[0] = '\0';
|
||||
va_list ap;
|
||||
int NumBytesPrinted;
|
||||
|
||||
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)
|
||||
Ale_ShowFixAlert (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
return Gbl.Alerts.Num;
|
||||
}
|
||||
|
||||
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,...)
|
||||
|
@ -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 (*FuncParams) (),
|
||||
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||
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,
|
||||
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);
|
||||
}
|
||||
|
||||
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,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -262,13 +416,26 @@ void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const c
|
|||
"</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 ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (void)
|
||||
void Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (void)
|
||||
{
|
||||
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_);
|
||||
}
|
||||
|
||||
|
|
26
swad_alert.h
26
swad_alert.h
|
@ -35,8 +35,7 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ale_MAX_BYTES_ALERT (16 * 1024 - 1) // Max. size for alert message
|
||||
// Important: the size of alert message must be enough large to store the longest message.
|
||||
#define Ale_MAX_ALERTS 10 // Max. number of alerts stored before of beeing shown
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************************* Public types ******************************/
|
||||
|
@ -58,19 +57,32 @@ typedef enum
|
|||
/****************************** 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_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
||||
void (*FuncParams) (),
|
||||
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||
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,
|
||||
Ale_AlertType_t AlertType,const char *fmt,...);
|
||||
void Ale_ShowLastAlertAndButton1 (void);
|
||||
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...);
|
||||
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
||||
void (*FuncParams) (),
|
||||
Btn_Button_t Button,const char *TxtButton);
|
||||
|
||||
void Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (void);
|
||||
void Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission (void);
|
||||
void Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1348,7 +1348,7 @@ void Asg_RecFormAssignment (void)
|
|||
else // Folder name not valid
|
||||
{
|
||||
NewAssignmentIsCorrect = false;
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
}
|
||||
else // NewAsg.SendWork == Asg_DO_NOT_SEND_WORK
|
||||
|
|
|
@ -1825,22 +1825,18 @@ void Ctr_ChangeCtrInsInConfig (void)
|
|||
Gbl.CurrentCtr.Ctr.ShrtName,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_centre_X_already_exists,
|
||||
Gbl.CurrentCtr.Ctr.ShrtName);
|
||||
}
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_centre_X_already_exists,
|
||||
Gbl.CurrentCtr.Ctr.ShrtName);
|
||||
else if (Ctr_CheckIfCtrNameExistsInIns ("FullName",
|
||||
Gbl.CurrentCtr.Ctr.FullName,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_centre_X_already_exists,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
}
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_centre_X_already_exists,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
else
|
||||
{
|
||||
/***** Update institution in table of centres *****/
|
||||
|
@ -1851,11 +1847,10 @@ void Ctr_ChangeCtrInsInConfig (void)
|
|||
/***** Initialize again current course, degree, centre... *****/
|
||||
Hie_InitHierarchy ();
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_centre_X_has_been_moved_to_the_institution_Y,
|
||||
Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
|
||||
/***** Create message to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_centre_X_has_been_moved_to_the_institution_Y,
|
||||
Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1867,7 +1862,7 @@ void Ctr_ChangeCtrInsInConfig (void)
|
|||
void Ctr_ContEditAfterChgCtrInConfig (void)
|
||||
{
|
||||
/***** Write error/success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Ctr_ShowConfiguration ();
|
||||
|
@ -1907,11 +1902,10 @@ void Ctr_ChangeCtrPlc (void)
|
|||
Ctr_UpdateCtrPlcDB (Gbl.Ctrs.EditingCtr.CtrCod,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 *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_place_of_the_centre_has_changed,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_place_of_the_centre_has_changed);
|
||||
Ctr_ShowAlertAndButtonToGoToCtr ();
|
||||
|
||||
/***** 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 *****/
|
||||
if (!NewCtrName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_centre_X_empty,
|
||||
CurrentCtrName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_can_not_leave_the_name_of_the_centre_X_empty,
|
||||
CurrentCtrName);
|
||||
else
|
||||
{
|
||||
/***** 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 (Ctr_CheckIfCtrNameExistsInIns (ParamName,NewCtrName,Ctr->CtrCod,Gbl.CurrentIns.Ins.InsCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_centre_X_already_exists,NewCtrName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_centre_X_already_exists,
|
||||
NewCtrName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Ctr_UpdateInsNameDB (Ctr->CtrCod,FieldName,NewCtrName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_centre_X_has_been_renamed_as_Y,
|
||||
CurrentCtrName,NewCtrName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_centre_X_has_been_renamed_as_Y,
|
||||
CurrentCtrName,NewCtrName);
|
||||
|
||||
/* Change current centre name in order to display it properly */
|
||||
Str_Copy (CurrentCtrName,NewCtrName,
|
||||
|
@ -2055,12 +2043,9 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
}
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_centre_X_has_not_changed,
|
||||
CurrentCtrName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
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
|
||||
and put button to go to centre changed *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Ctr_ShowAlertAndButtonToGoToCtr ();
|
||||
}
|
||||
else
|
||||
|
@ -2209,10 +2193,9 @@ void Ctr_ChangeCtrStatus (void)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to centre changed *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_status_of_the_centre_X_has_changed,
|
||||
Gbl.Ctrs.EditingCtr.ShrtName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_status_of_the_centre_X_has_changed,
|
||||
Gbl.Ctrs.EditingCtr.ShrtName);
|
||||
Ctr_ShowAlertAndButtonToGoToCtr ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
@ -2251,13 +2234,12 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void)
|
|||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Gbl.Ctrs.EditingCtr.ShrtName);
|
||||
Ale_ShowAlertAndButton (ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title,
|
||||
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
Ale_ShowLastAlertAndButton (ActSeeDeg,NULL,NULL,Ctr_PutParamGoToCtr,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title);
|
||||
}
|
||||
else
|
||||
/***** Alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
static void Ctr_PutParamGoToCtr (void)
|
||||
|
@ -2830,10 +2812,9 @@ static void Ctr_CreateCentre (unsigned Status)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to centre created *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Created_new_centre_X,
|
||||
Gbl.Ctrs.EditingCtr.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_centre_X,
|
||||
Gbl.Ctrs.EditingCtr.FullName);
|
||||
Ctr_ShowAlertAndButtonToGoToCtr ();
|
||||
}
|
||||
|
||||
|
|
|
@ -447,13 +447,11 @@ En OpenSWAD:
|
|||
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 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"
|
||||
* también cuando se intenta hacer con un usuario único desde su ficha
|
||||
*
|
||||
Version 18.69: Mar 09, 2019 Code refactoring related to alerts. (238779 lines)
|
||||
Version 18.68.3: Mar 08, 2019 Changes in styles of connected users.
|
||||
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)
|
||||
|
|
246
swad_course.c
246
swad_course.c
|
@ -1889,37 +1889,25 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
|
|||
/***** If name of course was in database... *****/
|
||||
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
|
||||
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
|
||||
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists,
|
||||
Gbl.Degs.EditingCrs.FullName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
Gbl.Degs.EditingCrs.FullName);
|
||||
else // Add new requested course to database
|
||||
Crs_CreateCourse (Status);
|
||||
}
|
||||
else // If there is not a course name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course);
|
||||
}
|
||||
else // Year not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_year_X_is_not_allowed,
|
||||
Gbl.Degs.EditingCrs.Year);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
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);
|
||||
|
||||
/***** Create success message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Created_new_course_X,
|
||||
Gbl.Degs.EditingCrs.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_course_X,
|
||||
Gbl.Degs.EditingCrs.FullName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2330,18 +2317,15 @@ void Crs_ChangeInsCrsCodInConfig (void)
|
|||
{
|
||||
Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,NewInstitutionalCrsCod);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
|
||||
Gbl.CurrentCrs.Crs.ShrtName,NewInstitutionalCrsCod);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
|
||||
Gbl.CurrentCrs.Crs.ShrtName,
|
||||
NewInstitutionalCrsCod);
|
||||
}
|
||||
else // The same institutional code
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institutional_code_of_the_course_X_has_not_changed,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
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))
|
||||
{
|
||||
Crs_UpdateInstitutionalCrsCod (&Gbl.Degs.EditingCrs,NewInstitutionalCrsCod);
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
|
||||
Gbl.Degs.EditingCrs.ShrtName,NewInstitutionalCrsCod);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
|
||||
Gbl.Degs.EditingCrs.ShrtName,
|
||||
NewInstitutionalCrsCod);
|
||||
}
|
||||
else // The same institutional code
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institutional_code_of_the_course_X_has_not_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_institutional_code_of_the_course_X_has_not_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
}
|
||||
else
|
||||
Lay_NoPermissionExit ();
|
||||
|
@ -2410,22 +2391,18 @@ void Crs_ChangeCrsDegInConfig (void)
|
|||
/***** If name of course was in database in the new degree... *****/
|
||||
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
|
||||
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],
|
||||
NewDeg.FullName,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
|
||||
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],
|
||||
NewDeg.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName);
|
||||
else // Update degree in database
|
||||
{
|
||||
/***** Update degree in table of courses *****/
|
||||
|
@ -2436,12 +2413,11 @@ void Crs_ChangeCrsDegInConfig (void)
|
|||
/***** Initialize again current course, degree, centre... *****/
|
||||
Hie_InitHierarchy ();
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_has_been_moved_to_the_degree_Y,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Gbl.CurrentDeg.Deg.FullName);
|
||||
/***** Create alert to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_course_X_has_been_moved_to_the_degree_Y,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Gbl.CurrentDeg.Deg.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2453,7 +2429,7 @@ void Crs_ChangeCrsDegInConfig (void)
|
|||
void Crs_ContEditAfterChgCrsInConfig (void)
|
||||
{
|
||||
/***** Write error/success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Crs_ShowIntroduction ();
|
||||
|
@ -2493,39 +2469,31 @@ void Crs_ChangeCrsYearInConfig (void)
|
|||
/***** If name of course was in database in the new year... *****/
|
||||
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShrtName,-1L,
|
||||
Gbl.CurrentCrs.Crs.DegCod,NewYear))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.CurrentCrs.Crs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.CurrentCrs.Crs.ShrtName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
|
||||
Gbl.CurrentCrs.Crs.DegCod,NewYear))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.CurrentCrs.Crs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else // Update year in database
|
||||
{
|
||||
/***** Update year in table of courses *****/
|
||||
Crs_UpdateCrsYear (&Gbl.CurrentCrs.Crs,NewYear);
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_year_of_the_course_X_has_changed,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
/***** Create alert to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_year_of_the_course_X_has_changed,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
}
|
||||
}
|
||||
else // Year not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_year_X_is_not_allowed,
|
||||
NewYear);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
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 (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L,
|
||||
Gbl.Degs.EditingCrs.DegCod,NewYear))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Degs.EditingCrs.ShrtName,Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Degs.EditingCrs.ShrtName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L,
|
||||
Gbl.Degs.EditingCrs.DegCod,NewYear))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Degs.EditingCrs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Degs.EditingCrs.FullName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else // Update year in database
|
||||
{
|
||||
/***** Update year in table of courses *****/
|
||||
Crs_UpdateCrsYear (&Gbl.Degs.EditingCrs,NewYear);
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_year_of_the_course_X_has_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_year_of_the_course_X_has_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
}
|
||||
}
|
||||
else // Year not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_year_X_is_not_allowed,
|
||||
NewYear);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_year_X_is_not_allowed,
|
||||
NewYear);
|
||||
}
|
||||
else
|
||||
Lay_NoPermissionExit ();
|
||||
|
@ -2705,12 +2665,9 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
{
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewCrsName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_course_X_empty,
|
||||
CurrentCrsName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_can_not_leave_the_name_of_the_course_X_empty,
|
||||
CurrentCrsName);
|
||||
else
|
||||
{
|
||||
/***** 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 (Crs_CheckIfCrsNameExistsInYearOfDeg (ParamName,NewCrsName,Crs->CrsCod,
|
||||
Crs->DegCod,Crs->Year))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_course_X_already_exists,
|
||||
NewCrsName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
NewCrsName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Crs_UpdateCrsNameDB (Crs->CrsCod,FieldName,NewCrsName);
|
||||
|
||||
/* Create message to show the change made */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_course_X_has_changed_to_Y,
|
||||
CurrentCrsName,NewCrsName);
|
||||
/* Create alert to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_name_of_the_course_X_has_changed_to_Y,
|
||||
CurrentCrsName,NewCrsName);
|
||||
|
||||
/* Change current course name in order to display it properly */
|
||||
Str_Copy (CurrentCrsName,NewCrsName,
|
||||
|
@ -2743,12 +2696,9 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
}
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_course_X_has_not_changed,
|
||||
CurrentCrsName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_of_the_course_X_has_not_changed,
|
||||
CurrentCrsName);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2817,11 +2767,10 @@ void Crs_ChangeCrsStatus (void)
|
|||
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod);
|
||||
Gbl.Degs.EditingCrs.Status = Status;
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_status_of_the_course_X_has_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
/***** Create alert to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_status_of_the_course_X_has_changed,
|
||||
Gbl.Degs.EditingCrs.ShrtName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2832,11 +2781,11 @@ void Crs_ContEditAfterChgCrs (void)
|
|||
{
|
||||
bool PutButtonToRequestRegistration;
|
||||
|
||||
/***** Start alert *****/
|
||||
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
|
||||
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
||||
{
|
||||
/***** Start alert *****/
|
||||
Ale_ShowLastAlertAndButton1 ();
|
||||
|
||||
/***** Put button to go to course changed *****/
|
||||
Crs_PutButtonToGoToCrs ();
|
||||
|
||||
|
@ -2866,10 +2815,13 @@ void Crs_ContEditAfterChgCrs (void)
|
|||
}
|
||||
if (PutButtonToRequestRegistration)
|
||||
Crs_PutButtonToRegisterInCrs ();
|
||||
|
||||
/***** End alert *****/
|
||||
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
|
||||
}
|
||||
|
||||
/***** End alert *****/
|
||||
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
|
||||
/***** Show possible delayed alerts *****/
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Crs_EditCourses ();
|
||||
|
|
|
@ -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;
|
||||
int NumBytesPrinted;
|
||||
|
|
|
@ -37,7 +37,7 @@ void DB_CreateTablesIfNotExist (void);
|
|||
void DB_OpenDBConnection (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,
|
||||
const char *fmt,...);
|
||||
|
|
|
@ -1158,10 +1158,9 @@ static void Deg_CreateDegree (unsigned Status)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to degree created *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Created_new_degree_X,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_degree_X,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
}
|
||||
|
||||
|
@ -1973,12 +1972,9 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewDegName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
|
||||
CurrentDegName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
|
||||
CurrentDegName);
|
||||
else
|
||||
{
|
||||
/***** 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 (Deg_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_degree_X_already_exists,
|
||||
NewDegName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
NewDegName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Deg_UpdateDegNameDB (Deg->DegCod,FieldName,NewDegName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_degree_X_has_changed_to_Y,
|
||||
CurrentDegName,NewDegName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_name_of_the_degree_X_has_changed_to_Y,
|
||||
CurrentDegName,NewDegName);
|
||||
|
||||
/* Change current degree name in order to display it properly */
|
||||
Str_Copy (CurrentDegName,NewDegName,
|
||||
|
@ -2010,12 +2002,9 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
}
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_degree_X_has_not_changed,
|
||||
CurrentDegName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
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 *****/
|
||||
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.CurrentDeg.Deg.ShrtName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.CurrentDeg.Deg.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.CurrentDeg.Deg.ShrtName);
|
||||
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.CurrentDeg.Deg.FullName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.CurrentDeg.Deg.FullName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.CurrentDeg.Deg.FullName);
|
||||
else
|
||||
{
|
||||
/***** Update centre in table of degrees *****/
|
||||
|
@ -2090,12 +2073,11 @@ void Deg_ChangeDegCtrInConfig (void)
|
|||
/***** Initialize again current course, degree, centre... *****/
|
||||
Hie_InitHierarchy ();
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_degree_X_has_been_moved_to_the_centre_Y,
|
||||
Gbl.CurrentDeg.Deg.FullName,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
/***** Create alert to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_degree_X_has_been_moved_to_the_centre_Y,
|
||||
Gbl.CurrentDeg.Deg.FullName,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2107,7 +2089,7 @@ void Deg_ChangeDegCtrInConfig (void)
|
|||
void Deg_ContEditAfterChgDegInConfig (void)
|
||||
{
|
||||
/***** Write success / warning message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_ShowConfiguration ();
|
||||
|
@ -2153,12 +2135,11 @@ void Deg_ChangeDegWWW (void)
|
|||
Str_Copy (Gbl.Degs.EditingDeg.WWW,NewWWW,
|
||||
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 *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
}
|
||||
else
|
||||
|
@ -2244,12 +2225,11 @@ void Deg_ChangeDegStatus (void)
|
|||
|
||||
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 *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_status_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_status_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
@ -2288,13 +2268,12 @@ void Deg_ShowAlertAndButtonToGoToDeg (void)
|
|||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
Ale_ShowAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title,
|
||||
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
Ale_ShowLastAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title);
|
||||
}
|
||||
else
|
||||
/***** Alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
static void Deg_PutParamGoToDeg (void)
|
||||
|
|
|
@ -1019,12 +1019,11 @@ void DT_ChangeDegreeType (void)
|
|||
"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
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 *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_type_of_degree_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_type_of_degree_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
|
|
@ -101,10 +101,10 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
|
|||
Ale_ShowAlert (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -244,7 +244,7 @@ void Dup_GetUsrCodAndListSimilarUsrs (void)
|
|||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
Dup_ListSimilarUsrs ();
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
static void Dup_ListSimilarUsrs (void)
|
||||
|
@ -451,7 +451,7 @@ void Dup_RemoveUsrFromListDupUsrs (void)
|
|||
Dup_ListDuplicateUsrs ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
151
swad_enrolment.c
151
swad_enrolment.c
|
@ -2151,7 +2151,7 @@ void Enr_AskIfRejectSignUp (void)
|
|||
}
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2184,7 +2184,7 @@ void Enr_RejectSignUp (void)
|
|||
Gbl.Usrs.Other.UsrDat.FullName);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/* Show again the rest of registrarion requests */
|
||||
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);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3439,10 +3439,10 @@ void Enr_ReqRemUsrFromCrs (void)
|
|||
if (Enr_CheckIfICanRemUsrFromCrs ())
|
||||
Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3451,8 +3451,6 @@ void Enr_ReqRemUsrFromCrs (void)
|
|||
|
||||
void Enr_RemUsrFromCrs1 (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
if (Pwd_GetConfirmationOnDangerousAction ())
|
||||
{
|
||||
/***** Get user to be removed *****/
|
||||
|
@ -3462,24 +3460,16 @@ void Enr_RemUsrFromCrs1 (void)
|
|||
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.CurrentCrs.Crs,
|
||||
Enr_REMOVE_WORKS,Cns_VERBOSE);
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3674,10 +3664,10 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
|
|||
}
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3720,9 +3710,6 @@ void Enr_CreateNewUsr1 (void)
|
|||
/***** Get user's ID from form *****/
|
||||
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
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = -1L;
|
||||
|
@ -3750,13 +3737,12 @@ void Enr_CreateNewUsr1 (void)
|
|||
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
|
||||
|
||||
/* Success message */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
}
|
||||
}
|
||||
else // User does not belong to current course
|
||||
|
@ -3766,11 +3752,10 @@ void Enr_CreateNewUsr1 (void)
|
|||
Enr_SET_ACCEPTED_TO_FALSE);
|
||||
|
||||
/* Success message */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName);
|
||||
}
|
||||
|
||||
/***** Change user's groups *****/
|
||||
|
@ -3800,24 +3785,20 @@ void Enr_CreateNewUsr1 (void)
|
|||
Tab_SetCurrentTab ();
|
||||
}
|
||||
else // User's ID not valid
|
||||
{
|
||||
/***** Error message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_ID_X_is_not_valid,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
||||
}
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
Txt_The_ID_X_is_not_valid,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
||||
}
|
||||
|
||||
void Enr_CreateNewUsr2 (void)
|
||||
{
|
||||
if (Gbl.DelayedAlert.Type == Ale_ERROR) // User's ID not valid
|
||||
Ale_ShowDelayedAlert ();
|
||||
else // User's ID valid
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_ERROR) // User's ID not valid
|
||||
Ale_ShowAlerts (NULL);
|
||||
else // User's ID valid
|
||||
{
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
||||
/***** Show optional alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -3837,9 +3818,6 @@ void Enr_ModifyUsr1 (void)
|
|||
Rol_Role_t OldRole;
|
||||
Rol_Role_t NewRole;
|
||||
|
||||
/***** Initialize alert type and message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
|
||||
|
||||
/***** Get user from form *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
|
@ -3878,13 +3856,12 @@ void Enr_ModifyUsr1 (void)
|
|||
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole);
|
||||
|
||||
/* Set success message */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName,
|
||||
Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
}
|
||||
}
|
||||
else // User does not belong to current course
|
||||
|
@ -3894,10 +3871,10 @@ void Enr_ModifyUsr1 (void)
|
|||
Enr_SET_ACCEPTED_TO_FALSE);
|
||||
|
||||
/* Set success message */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.CurrentCrs.Crs.FullName);
|
||||
}
|
||||
|
||||
/***** Change user's groups *****/
|
||||
|
@ -3941,64 +3918,64 @@ void Enr_ModifyUsr1 (void)
|
|||
}
|
||||
}
|
||||
else
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_CENTRE_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
|
||||
if (ItsMe || Gbl.Usrs.Me.Role.Logged < Rol_TCH)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_USR_FROM_CRS:
|
||||
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_TCH)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_DEGREE_ADMIN:
|
||||
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_CENTRE_ADMIN:
|
||||
if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
||||
if (!ItsMe && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
|
||||
if (!Acc_CheckIfICanEliminateAccount (Gbl.Usrs.Other.UsrDat.UsrCod))
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
default:
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
void Enr_ModifyUsr2 (void)
|
||||
{
|
||||
if (Gbl.DelayedAlert.Type == Ale_WARNING)
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_WARNING)
|
||||
Ale_ShowAlerts (NULL);
|
||||
else // No error
|
||||
switch (Gbl.Usrs.RegRemAction)
|
||||
{
|
||||
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
/***** Show optional alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show user's record *****/
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
||||
|
@ -4184,20 +4160,13 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
}
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_THE_USER_X_has_been_removed_from_the_course_Y,
|
||||
UsrDat->FullName,Crs->FullName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_THE_USER_X_has_been_removed_from_the_course_Y,
|
||||
UsrDat->FullName,Crs->FullName);
|
||||
}
|
||||
else // User does not belong to course
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -8865,7 +8865,7 @@ void Brw_RecFolderFileBrowser (void)
|
|||
}
|
||||
}
|
||||
else // Folder name not valid
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
else
|
||||
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);
|
||||
}
|
||||
else // Folder name not valid
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
else
|
||||
Lay_ShowErrorAndExit (Txt_You_can_not_rename_this_folder);
|
||||
|
@ -9014,7 +9014,7 @@ void Brw_RcvFileInFileBrwDropzone (void)
|
|||
else
|
||||
fprintf (stdout,"Status: 501 Not Implemented\r\n\r\n"
|
||||
"%s\n",
|
||||
Gbl.DelayedAlert.Txt);
|
||||
Ale_GetTextOfLastAlert ());
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -9027,7 +9027,7 @@ void Brw_RcvFileInFileBrwClassic (void)
|
|||
Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD);
|
||||
|
||||
/***** Show possible alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show again file browser *****/
|
||||
Brw_ShowAgainFileBrowserOrWorks ();
|
||||
|
@ -9082,7 +9082,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
/***** Check if uploading this kind of file is allowed *****/
|
||||
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 */
|
||||
snprintf (Path,sizeof (Path),
|
||||
|
@ -9100,12 +9100,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
|
||||
/* Check if the destination file exists */
|
||||
if (Fil_CheckIfPathExists (Path))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
else // Destination file does not exist
|
||||
{
|
||||
/* End receiving the file */
|
||||
|
@ -9126,10 +9123,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
if (rename (PathTmp,Path)) // Fail
|
||||
{
|
||||
Fil_RemoveTree (PathTmp);
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_could_not_create_file_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_could_not_create_file_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
}
|
||||
else // Success
|
||||
{
|
||||
|
@ -9139,10 +9135,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
if (Brw_CheckIfQuotaExceded ())
|
||||
{
|
||||
Fil_RemoveTree (Path);
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9171,11 +9166,10 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
Brw_IS_FOLDER,
|
||||
Gbl.FileBrowser.FilFolLnkName,
|
||||
FileNameToShow);
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_file_X_has_been_placed_inside_the_folder_Y,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,
|
||||
FileNameToShow);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_file_X_has_been_placed_inside_the_folder_Y,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,
|
||||
FileNameToShow);
|
||||
}
|
||||
UploadSucessful = true;
|
||||
|
||||
|
@ -9219,18 +9213,12 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
}
|
||||
}
|
||||
else // Empty filename
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML);
|
||||
}
|
||||
else // I do not have permission to create files here
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_UPLOAD_FILE_Forbidden_NO_HTML,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_Forbidden_NO_HTML);
|
||||
|
||||
return UploadSucessful;
|
||||
}
|
||||
|
@ -9414,7 +9402,7 @@ void Brw_RecLinkFileBrowser (void)
|
|||
/*****************************************************************************/
|
||||
// Returns true if file type is 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)
|
||||
{
|
||||
|
@ -9429,9 +9417,9 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
|
|||
/* Check file extension */
|
||||
if (!Str_FileIsHTML (Gbl.FileBrowser.NewFilFolLnkName))
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_not_HTML_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_not_HTML_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -9442,9 +9430,9 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
|
|||
if (strcmp (MIMEType,"application/octetstream"))
|
||||
if (strcmp (MIMEType,"application/octet"))
|
||||
{ // MIME type forbidden
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -9452,18 +9440,18 @@ static bool Brw_CheckIfUploadIsAllowed (const char *MIMEType)
|
|||
/* Check file extension */
|
||||
if (!Ext_CheckIfFileExtensionIsAllowed (Gbl.FileBrowser.NewFilFolLnkName))
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_extension_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_extension_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check MIME type*/
|
||||
if (!MIM_CheckIfMIMETypeIsAllowed (MIMEType))
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_UPLOAD_FILE_X_MIME_type_Y_not_allowed_NO_HTML,
|
||||
Gbl.FileBrowser.NewFilFolLnkName,MIMEType);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -663,7 +663,7 @@ void Fol_ListFollowing (void)
|
|||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else // If user not specified, view my profile
|
||||
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat);
|
||||
|
@ -728,7 +728,7 @@ static void Fol_ListFollowingUsr (struct UsrData *UsrDat)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -745,7 +745,7 @@ void Fol_ListFollowers (void)
|
|||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else // If user not specified, view my profile
|
||||
Fol_ListFollowersUsr (&Gbl.Usrs.Me.UsrDat);
|
||||
|
@ -818,7 +818,7 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1009,7 +1009,6 @@ static void Fol_PutIconToUnfollow (struct UsrData *UsrDat)
|
|||
|
||||
void Fol_FollowUsr1 (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool CreateNotif;
|
||||
bool NotifyByEmail;
|
||||
|
||||
|
@ -1046,31 +1045,21 @@ void Fol_FollowUsr1 (void)
|
|||
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
|
||||
0));
|
||||
}
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
void Fol_FollowUsr2 (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
||||
/***** Show user's profile again *****/
|
||||
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
if (Gbl.DelayedAlert.Type != Ale_SUCCESS)
|
||||
Ale_ShowDelayedAlert ();
|
||||
if (Ale_GetTypeOfLastAlert () != Ale_SUCCESS)
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1079,8 +1068,6 @@ void Fol_FollowUsr2 (void)
|
|||
|
||||
void Fol_UnfollowUsr1 (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
/***** Get user to be unfollowed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
|
@ -1098,20 +1085,16 @@ void Fol_UnfollowUsr1 (void)
|
|||
/***** Flush cache *****/
|
||||
Fol_FlushCacheFollow ();
|
||||
}
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,""); // Txt not used
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
void Fol_UnfollowUsr2 (void)
|
||||
{
|
||||
/***** Get user to be unfollowed *****/
|
||||
if (Gbl.DelayedAlert.Type == Ale_SUCCESS)
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
||||
{
|
||||
/***** Show user's profile again *****/
|
||||
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
|
||||
}
|
||||
else
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
19
swad_forum.c
19
swad_forum.c
|
@ -4285,6 +4285,7 @@ void For_RemoveThread (void)
|
|||
extern const char *Txt_Thread_X_removed;
|
||||
extern const char *Txt_Thread_removed;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
|
||||
|
||||
/***** Get parameters related to forum *****/
|
||||
For_GetParamsForum ();
|
||||
|
@ -4304,10 +4305,10 @@ void For_RemoveThread (void)
|
|||
/***** Show the threads again *****/
|
||||
if (Subject[0])
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (Message,sizeof (Message),
|
||||
Txt_Thread_X_removed,Subject);
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
|
||||
Ale_SUCCESS,Message);
|
||||
}
|
||||
else
|
||||
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_marked_to_be_moved;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
|
||||
|
||||
/***** Get parameters related to forum *****/
|
||||
For_GetParamsForum ();
|
||||
|
@ -4342,10 +4344,10 @@ void For_CutThread (void)
|
|||
/***** Show the threads again *****/
|
||||
if (Subject[0])
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (Message,sizeof (Message),
|
||||
Txt_Thread_X_marked_to_be_moved,Subject);
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
|
||||
Ale_SUCCESS,Message);
|
||||
}
|
||||
else
|
||||
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_moved_to_this_forum;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
char Message[256 + Cns_MAX_BYTES_SUBJECT + 1];
|
||||
|
||||
/***** Get parameters related to forum *****/
|
||||
For_GetParamsForum ();
|
||||
|
@ -4380,11 +4383,11 @@ void For_PasteThread (void)
|
|||
/***** Show the threads again *****/
|
||||
if (Subject[0])
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (Message,sizeof (Message),
|
||||
Txt_The_thread_X_is_already_in_this_forum,
|
||||
Subject);
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
Ale_WARNING,Gbl.DelayedAlert.Txt);
|
||||
Ale_WARNING,Message);
|
||||
}
|
||||
else
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
|
@ -4401,11 +4404,11 @@ void For_PasteThread (void)
|
|||
/***** Show the threads again *****/
|
||||
if (Subject[0])
|
||||
{
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (Message,sizeof (Message),
|
||||
Txt_Thread_X_moved_to_this_forum,
|
||||
Subject);
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
|
||||
Ale_SUCCESS,Message);
|
||||
}
|
||||
else
|
||||
For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod,
|
||||
|
|
|
@ -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.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.LockedTables = false;
|
||||
|
@ -540,4 +540,5 @@ void Gbl_Cleanup (void)
|
|||
Fil_CloseXMLFile ();
|
||||
Fil_CloseReportFile ();
|
||||
Par_FreeParams ();
|
||||
Ale_ResetAllAlerts ();
|
||||
}
|
||||
|
|
|
@ -107,10 +107,14 @@ struct Globals
|
|||
} Form;
|
||||
struct
|
||||
{
|
||||
Ale_AlertType_t Type;
|
||||
char Txt[Ale_MAX_BYTES_ALERT + 1];
|
||||
const char *Section; // Where to display the alert
|
||||
} DelayedAlert; // Alert message created in a function and printed in a subsequent function.
|
||||
unsigned Num; // Number of alert
|
||||
struct
|
||||
{
|
||||
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
|
||||
{
|
||||
size_t ContentLength;
|
||||
|
|
177
swad_group.c
177
swad_group.c
|
@ -85,11 +85,13 @@ extern struct Globals Gbl;
|
|||
/***************************** Internal prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes,
|
||||
Ale_AlertType_t AlertTypeGroups,const char *MessageGroups);
|
||||
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *AlertTextGroupTypes,
|
||||
Ale_AlertType_t AlertTypeGroups,const char *AlertTextGroups);
|
||||
static void Grp_ReqEditGroupsInternal0 (void);
|
||||
static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes);
|
||||
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const char *MessageGroups);
|
||||
static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,
|
||||
const char *AlertTextGroupTypes);
|
||||
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,
|
||||
const char *AlertTextGroups);
|
||||
|
||||
static void Grp_EditGroupTypes (void);
|
||||
static void Grp_EditGroups (void);
|
||||
|
@ -213,12 +215,14 @@ void Grp_ReqEditGroups (void)
|
|||
Ale_INFO,NULL);
|
||||
}
|
||||
|
||||
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes,
|
||||
Ale_AlertType_t AlertTypeGroups,const char *MessageGroups)
|
||||
static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,
|
||||
const char *AlertTextGroupTypes,
|
||||
Ale_AlertType_t AlertTypeGroups,
|
||||
const char *AlertTextGroups)
|
||||
{
|
||||
Grp_ReqEditGroupsInternal0 ();
|
||||
Grp_ReqEditGroupsInternal1 (AlertTypeGroupTypes,MessageGroupTypes);
|
||||
Grp_ReqEditGroupsInternal2 (AlertTypeGroups,MessageGroups);
|
||||
Grp_ReqEditGroupsInternal1 (AlertTypeGroupTypes,AlertTextGroupTypes);
|
||||
Grp_ReqEditGroupsInternal2 (AlertTypeGroups,AlertTextGroups);
|
||||
}
|
||||
|
||||
static void Grp_ReqEditGroupsInternal0 (void)
|
||||
|
@ -227,7 +231,8 @@ static void Grp_ReqEditGroupsInternal0 (void)
|
|||
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 *****/
|
||||
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);
|
||||
|
||||
/***** Show optional alert *****/
|
||||
if (MessageGroupTypes)
|
||||
if (MessageGroupTypes[0])
|
||||
Ale_ShowAlert (AlertTypeGroupTypes,MessageGroupTypes);
|
||||
if (AlertTextGroupTypes)
|
||||
if (AlertTextGroupTypes[0])
|
||||
Ale_ShowAlert (AlertTypeGroupTypes,AlertTextGroupTypes);
|
||||
|
||||
/***** Put form to edit group types *****/
|
||||
Grp_EditGroupTypes ();
|
||||
|
@ -250,12 +255,13 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons
|
|||
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 *****/
|
||||
if (MessageGroups)
|
||||
if (MessageGroups[0])
|
||||
Ale_ShowAlert (AlertTypeGroups,MessageGroups);
|
||||
if (AlertTextGroups)
|
||||
if (AlertTextGroups[0])
|
||||
Ale_ShowAlert (AlertTypeGroups,AlertTextGroups);
|
||||
|
||||
/***** Put form to edit groups *****/
|
||||
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 (ChangesMade)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_requested_group_changes_were_successful,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_requested_group_changes_were_successful);
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_has_been_no_change_in_groups,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_There_has_been_no_change_in_groups);
|
||||
}
|
||||
}
|
||||
else if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
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 which I want to belong to *****/
|
||||
Grp_FreeListCodGrp (&LstGrpsIWant);
|
||||
|
@ -731,6 +728,9 @@ void Grp_ChangeOtherUsrGrps (void)
|
|||
/***** Register user in the selected groups *****/
|
||||
if (SelectionIsValid)
|
||||
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 *****/
|
||||
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_You_must_specify_the_name_of_the_new_type_of_group;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the name of group type */
|
||||
|
@ -3770,7 +3771,7 @@ void Grp_RecFormNewGrpTyp (void)
|
|||
if (Grp_CheckIfGroupTypeNameExists (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,-1L))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_type_of_group_X_already_exists,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
}
|
||||
|
@ -3779,7 +3780,7 @@ void Grp_RecFormNewGrpTyp (void)
|
|||
Grp_CreateGroupType ();
|
||||
|
||||
AlertType = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_Created_new_type_of_group_X,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
}
|
||||
|
@ -3787,12 +3788,12 @@ void Grp_RecFormNewGrpTyp (void)
|
|||
else // If there is not a group type name
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_type_of_group,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Str_Copy (AlertTxt,Txt_You_must_specify_the_name_of_the_new_type_of_group,
|
||||
sizeof (AlertTxt) - 1);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
|
||||
Ale_INFO,NULL);
|
||||
}
|
||||
|
||||
|
@ -3820,6 +3821,7 @@ void Grp_RecFormNewGrp (void)
|
|||
extern const char *Txt_Created_new_group_X;
|
||||
extern const char *Txt_You_must_specify_the_name_of_the_new_group;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
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))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_group_X_already_exists,
|
||||
Gbl.CurrentCrs.Grps.GrpName);
|
||||
}
|
||||
|
@ -3854,7 +3856,7 @@ void Grp_RecFormNewGrp (void)
|
|||
|
||||
/* Write success message */
|
||||
AlertType = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_Created_new_group_X,
|
||||
Gbl.CurrentCrs.Grps.GrpName);
|
||||
}
|
||||
|
@ -3862,20 +3864,20 @@ void Grp_RecFormNewGrp (void)
|
|||
else // If there is not a group name
|
||||
{
|
||||
AlertType = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_group,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Str_Copy (AlertTxt,Txt_You_must_specify_the_name_of_the_new_group,
|
||||
sizeof (AlertTxt) - 1);
|
||||
}
|
||||
}
|
||||
else // Invalid group type
|
||||
{
|
||||
AlertType = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong type of group.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Str_Copy (AlertTxt,"Wrong type of group.",
|
||||
sizeof (AlertTxt) - 1);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
|
||||
AlertType,Gbl.DelayedAlert.Txt);
|
||||
AlertType,AlertTxt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4118,6 +4120,7 @@ void Grp_RemoveGroup (void)
|
|||
static void Grp_RemoveGroupTypeCompletely (void)
|
||||
{
|
||||
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 *****/
|
||||
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
|
||||
|
@ -4158,12 +4161,12 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
|||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** 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,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (Ale_SUCCESS,AlertTxt,
|
||||
Ale_INFO,NULL);
|
||||
}
|
||||
|
||||
|
@ -4175,6 +4178,7 @@ static void Grp_RemoveGroupCompletely (void)
|
|||
{
|
||||
extern const char *Txt_Group_X_removed;
|
||||
struct GroupData GrpDat;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get name and type of the group from database *****/
|
||||
GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
|
||||
|
@ -4208,13 +4212,13 @@ static void Grp_RemoveGroupCompletely (void)
|
|||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_Group_X_removed,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
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;
|
||||
struct GroupData GrpDat;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get group code *****/
|
||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||
|
@ -4240,14 +4245,14 @@ void Grp_OpenGroup (void)
|
|||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** 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,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.Open = true;
|
||||
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;
|
||||
struct GroupData GrpDat;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get group code *****/
|
||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||
|
@ -4273,14 +4279,14 @@ void Grp_CloseGroup (void)
|
|||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** 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,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.Open = false;
|
||||
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;
|
||||
struct GroupData GrpDat;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get group code *****/
|
||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||
|
@ -4306,14 +4313,14 @@ void Grp_EnableFileZonesGrp (void)
|
|||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** 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,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.FileZones = true;
|
||||
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;
|
||||
struct GroupData GrpDat;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get group code *****/
|
||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||
|
@ -4339,14 +4347,14 @@ void Grp_DisableFileZonesGrp (void)
|
|||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** 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,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.FileZones = false;
|
||||
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
|
||||
Ale_SUCCESS,Gbl.DelayedAlert.Txt);
|
||||
Ale_SUCCESS,AlertTxt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4360,6 +4368,7 @@ void Grp_ChangeGroupType (void)
|
|||
long NewGrpTypCod;
|
||||
struct GroupData GrpDat;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get group code */
|
||||
|
@ -4378,7 +4387,7 @@ void Grp_ChangeGroupType (void)
|
|||
{
|
||||
/* Create warning message */
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_group_X_already_exists,
|
||||
GrpDat.GrpName);
|
||||
}
|
||||
|
@ -4391,7 +4400,7 @@ void Grp_ChangeGroupType (void)
|
|||
|
||||
/* Create message to show the change made */
|
||||
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,
|
||||
GrpDat.GrpName);
|
||||
}
|
||||
|
@ -4399,7 +4408,7 @@ void Grp_ChangeGroupType (void)
|
|||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod;
|
||||
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
|
||||
AlertType,Gbl.DelayedAlert.Txt);
|
||||
AlertType,AlertTxt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4412,6 +4421,7 @@ void Grp_ChangeGroupClassroom (void)
|
|||
long NewClaCod;
|
||||
struct GroupData GrpDat;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get group code */
|
||||
|
@ -4432,14 +4442,14 @@ void Grp_ChangeGroupClassroom (void)
|
|||
|
||||
/* Create message to show the change made */
|
||||
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,
|
||||
GrpDat.GrpName);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.ClaCod = NewClaCod;
|
||||
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;
|
||||
bool NewMandatoryEnrolment;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
|
||||
|
||||
/***** Get parameters of the form *****/
|
||||
/* Get the código of type of group */
|
||||
|
@ -4470,7 +4481,7 @@ void Grp_ChangeMandatGrpTyp (void)
|
|||
if (Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment)
|
||||
{
|
||||
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,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
}
|
||||
|
@ -4485,7 +4496,7 @@ void Grp_ChangeMandatGrpTyp (void)
|
|||
|
||||
/***** Write message to show the change made *****/
|
||||
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 :
|
||||
Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
|
@ -4493,7 +4504,7 @@ void Grp_ChangeMandatGrpTyp (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment;
|
||||
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
|
||||
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;
|
||||
bool NewMultipleEnrolment;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
|
||||
|
||||
/***** Get parameters from the form *****/
|
||||
/* Get the code of type of group */
|
||||
|
@ -4525,7 +4537,7 @@ void Grp_ChangeMultiGrpTyp (void)
|
|||
if (Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment)
|
||||
{
|
||||
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,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
}
|
||||
|
@ -4541,7 +4553,7 @@ void Grp_ChangeMultiGrpTyp (void)
|
|||
|
||||
/***** Write message to show the change made *****/
|
||||
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 :
|
||||
Txt_Now_each_student_can_only_belong_to_a_group_of_type_X,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
|
@ -4549,7 +4561,7 @@ void Grp_ChangeMultiGrpTyp (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment;
|
||||
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
|
||||
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);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (Ale_SUCCESS,NULL,
|
||||
Ale_INFO,NULL);
|
||||
}
|
||||
|
||||
|
@ -4603,6 +4615,7 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
struct GroupData GrpDat;
|
||||
unsigned NewMaxStds;
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get parameters of the form *****/
|
||||
/* Get group code */
|
||||
|
@ -4625,7 +4638,7 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
if (GrpDat.MaxStudents == NewMaxStds)
|
||||
{
|
||||
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,
|
||||
GrpDat.GrpName);
|
||||
}
|
||||
|
@ -4640,11 +4653,11 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP)
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_group_X_does_not_have_a_student_limit_now,
|
||||
GrpDat.GrpName);
|
||||
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,
|
||||
GrpDat.GrpName,NewMaxStds);
|
||||
}
|
||||
|
@ -4652,7 +4665,7 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
/***** Show the form again *****/
|
||||
Gbl.CurrentCrs.Grps.MaxStudents = NewMaxStds;
|
||||
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;
|
||||
char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the group type */
|
||||
|
@ -4708,7 +4722,7 @@ void Grp_RenameGroupType (void)
|
|||
if (!NewNameGrpTyp[0])
|
||||
{
|
||||
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,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
|
||||
}
|
||||
|
@ -4722,7 +4736,7 @@ void Grp_RenameGroupType (void)
|
|||
if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_type_of_group_X_already_exists,
|
||||
NewNameGrpTyp);
|
||||
}
|
||||
|
@ -4737,7 +4751,7 @@ void Grp_RenameGroupType (void)
|
|||
|
||||
/***** Write message to show the change made *****/
|
||||
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,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp);
|
||||
}
|
||||
|
@ -4745,7 +4759,7 @@ void Grp_RenameGroupType (void)
|
|||
else // The same name
|
||||
{
|
||||
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,
|
||||
NewNameGrpTyp);
|
||||
}
|
||||
|
@ -4754,7 +4768,7 @@ void Grp_RenameGroupType (void)
|
|||
/***** Show the form again *****/
|
||||
Str_Copy (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp,
|
||||
Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
||||
Grp_ReqEditGroupsInternal (AlertType,Gbl.DelayedAlert.Txt,
|
||||
Grp_ReqEditGroupsInternal (AlertType,AlertTxt,
|
||||
Ale_INFO,NULL);
|
||||
}
|
||||
|
||||
|
@ -4771,6 +4785,7 @@ void Grp_RenameGroup (void)
|
|||
struct GroupData GrpDat;
|
||||
char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1];
|
||||
Ale_AlertType_t AlertType;
|
||||
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the group */
|
||||
|
@ -4788,7 +4803,7 @@ void Grp_RenameGroup (void)
|
|||
if (!NewNameGrp[0])
|
||||
{
|
||||
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,
|
||||
GrpDat.GrpName);
|
||||
}
|
||||
|
@ -4802,7 +4817,7 @@ void Grp_RenameGroup (void)
|
|||
if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_group_X_already_exists,
|
||||
NewNameGrp);
|
||||
}
|
||||
|
@ -4815,7 +4830,7 @@ void Grp_RenameGroup (void)
|
|||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
Txt_The_group_X_has_been_renamed_as_Y,
|
||||
GrpDat.GrpName,NewNameGrp);
|
||||
}
|
||||
|
@ -4823,7 +4838,7 @@ void Grp_RenameGroup (void)
|
|||
else // The same name
|
||||
{
|
||||
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,
|
||||
NewNameGrp);
|
||||
}
|
||||
|
@ -4833,7 +4848,7 @@ void Grp_RenameGroup (void)
|
|||
Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp,
|
||||
Grp_MAX_BYTES_GROUP_NAME);
|
||||
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
|
||||
AlertType,Gbl.DelayedAlert.Txt);
|
||||
AlertType,AlertTxt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -681,16 +681,15 @@ void Hld_RemoveHoliday1 (void)
|
|||
Hld.HldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Holiday_X_removed,
|
||||
Hld.Name);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Holiday_X_removed,
|
||||
Hld.Name);
|
||||
}
|
||||
|
||||
void Hld_RemoveHoliday2 (void)
|
||||
{
|
||||
/***** Show success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
@ -731,16 +730,15 @@ void Hld_ChangeHolidayPlace1 (void)
|
|||
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_place_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,NewPlace.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_place_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,NewPlace.FullName);
|
||||
}
|
||||
|
||||
void Hld_ChangeHolidayPlace2 (void)
|
||||
{
|
||||
/***** Show success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
@ -775,16 +773,15 @@ void Hld_ChangeHolidayType1 (void)
|
|||
(unsigned) Hld->HldTyp,Hld->HldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_type_of_the_holiday_X_has_changed,
|
||||
Hld->Name);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_type_of_the_holiday_X_has_changed,
|
||||
Hld->Name);
|
||||
}
|
||||
|
||||
void Hld_ChangeHolidayType2 (void)
|
||||
{
|
||||
/***** Show success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
@ -874,11 +871,10 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
|||
Dat_AssignDate (PtrDate,&NewDate);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Dat_ConvDateToDateStr (&NewDate,StrDate);
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_date_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,StrDate);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_date_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,StrDate);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -888,7 +884,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
|||
void Hld_ChangeDate2 (void)
|
||||
{
|
||||
/***** Show success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
@ -921,12 +917,9 @@ void Hld_RenameHoliday1 (void)
|
|||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewHldName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_holiday_X_empty,
|
||||
Hld->Name);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_can_not_leave_the_name_of_the_holiday_X_empty,
|
||||
Hld->Name);
|
||||
else
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
|
@ -942,25 +935,21 @@ void Hld_RenameHoliday1 (void)
|
|||
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,NewHldName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_name_of_the_holiday_X_has_changed_to_Y,
|
||||
Hld->Name,NewHldName);
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_holiday_X_has_not_changed,
|
||||
Hld->Name);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_of_the_holiday_X_has_not_changed,
|
||||
Hld->Name);
|
||||
}
|
||||
}
|
||||
|
||||
void Hld_RenameHoliday2 (void)
|
||||
{
|
||||
/***** Write error/success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
@ -1181,24 +1170,20 @@ void Hld_RecFormNewHoliday1 (void)
|
|||
Hld_CreateHoliday (Hld);
|
||||
|
||||
/* Success message */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Created_new_holiday_X,
|
||||
Hld->Name);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_holiday_X,
|
||||
Hld->Name);
|
||||
}
|
||||
else // If there is not a holiday name
|
||||
{
|
||||
/* Error message */
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_must_specify_the_name_of_the_new_holiday,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_name_of_the_new_holiday);
|
||||
}
|
||||
|
||||
void Hld_RecFormNewHoliday2 (void)
|
||||
{
|
||||
/***** Write error/success message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Hld_EditHolidays ();
|
||||
|
|
|
@ -94,7 +94,10 @@ static void Ins_PutParamOtherInsCod (long InsCod);
|
|||
static long Ins_GetParamOtherInsCod (void);
|
||||
|
||||
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_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 *****/
|
||||
if (!NewInsName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
|
||||
CurrentInsName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
|
||||
CurrentInsName);
|
||||
else
|
||||
{
|
||||
/***** 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 institution was in database... *****/
|
||||
if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,Gbl.CurrentCty.Cty.CtyCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institution_X_already_exists,
|
||||
NewInsName);
|
||||
}
|
||||
if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,
|
||||
Gbl.CurrentCty.Cty.CtyCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
NewInsName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Ins_UpdateInsNameDB (Ins->InsCod,FieldName,NewInsName);
|
||||
|
||||
/* Create message to show the change made */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institution_X_has_been_renamed_as_Y,
|
||||
CurrentInsName,NewInsName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_institution_X_has_been_renamed_as_Y,
|
||||
CurrentInsName,NewInsName);
|
||||
|
||||
/* Change current institution name in order to display it properly */
|
||||
Str_Copy (CurrentInsName,NewInsName,
|
||||
|
@ -1874,12 +1871,9 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
|
|||
}
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_name_of_the_institution_X_has_not_changed,
|
||||
CurrentInsName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
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 *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
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 *****/
|
||||
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 *****/
|
||||
if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.CurrentIns.Ins.ShrtName,-1L,NewCty.CtyCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.CurrentIns.Ins.FullName,-1L,NewCty.CtyCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
else
|
||||
{
|
||||
/***** Update the table changing the country of the institution *****/
|
||||
|
@ -1958,10 +1949,9 @@ void Ins_ChangeInsCtyInConfig (void)
|
|||
Hie_InitHierarchy ();
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_country_of_the_institution_X_has_changed_to_Y,
|
||||
Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_country_of_the_institution_X_has_changed_to_Y,
|
||||
Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1973,7 +1963,7 @@ void Ins_ChangeInsCtyInConfig (void)
|
|||
void Ins_ContEditAfterChgInsInConfig (void)
|
||||
{
|
||||
/***** Write success / warning message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Ins_ShowConfiguration ();
|
||||
|
@ -2021,10 +2011,9 @@ void Ins_ChangeInsWWW (void)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to institution changed *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_new_web_address_is_X,
|
||||
NewWWW);
|
||||
Ins_ShowAlertAndButtonToGoToIns ();
|
||||
}
|
||||
else
|
||||
|
@ -2111,10 +2100,9 @@ void Ins_ChangeInsStatus (void)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to institution changed *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_status_of_the_institution_X_has_changed,
|
||||
Gbl.Inss.EditingIns.ShrtName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_status_of_the_institution_X_has_changed,
|
||||
Gbl.Inss.EditingIns.ShrtName);
|
||||
Ins_ShowAlertAndButtonToGoToIns ();
|
||||
|
||||
/***** 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 (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod)
|
||||
/***** Alert with button to go to degree *****/
|
||||
Ale_ShowAlertAndButton (ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title,
|
||||
Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
Ale_ShowLastAlertAndButton (ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title);
|
||||
else
|
||||
/***** Alert *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
static void Ins_PutParamGoToIns (void)
|
||||
|
@ -2431,10 +2418,9 @@ static void Ins_CreateInstitution (unsigned Status)
|
|||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to institution created *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Created_new_institution_X,
|
||||
Gbl.Inss.EditingIns.FullName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_institution_X,
|
||||
Gbl.Inss.EditingIns.FullName);
|
||||
Ins_ShowAlertAndButtonToGoToIns ();
|
||||
}
|
||||
|
||||
|
|
133
swad_mail.c
133
swad_mail.c
|
@ -627,13 +627,9 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewMaiName[0])
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_You_can_not_leave_the_name_of_the_email_domain_X_empty,
|
||||
CurrentMaiName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_You_can_not_leave_the_name_of_the_email_domain_X_empty,
|
||||
CurrentMaiName);
|
||||
else
|
||||
{
|
||||
/***** 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 (Mai_CheckIfMailDomainNameExists (ParamName,NewMaiName,Mai->MaiCod))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_domain_X_already_exists,
|
||||
NewMaiName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_already_exists,
|
||||
NewMaiName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Mai_UpdateMailDomainNameDB (Mai->MaiCod,FieldName,NewMaiName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_domain_X_has_been_renamed_as_Y,
|
||||
CurrentMaiName,NewMaiName);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_has_been_renamed_as_Y,
|
||||
CurrentMaiName,NewMaiName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_INFO;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_domain_X_has_not_changed,
|
||||
CurrentMaiName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_INFO,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_has_not_changed,
|
||||
CurrentMaiName);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
@ -1215,9 +1201,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
|
|||
bool Confirmed;
|
||||
Act_Action_t NextAction;
|
||||
|
||||
/***** Show possible alert *****/
|
||||
if (Gbl.DelayedAlert.Section == (const char *) Mai_EMAIL_SECTION_ID)
|
||||
Ale_ShowDelayedAlert ();
|
||||
/***** Show possible alerts *****/
|
||||
Ale_ShowAlerts (Mai_EMAIL_SECTION_ID);
|
||||
|
||||
/***** Help message *****/
|
||||
if (IMustFillInEmail)
|
||||
|
@ -1427,10 +1412,10 @@ void Mai_RemoveOtherUsrEmail (void)
|
|||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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 *****/
|
||||
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Email_X_removed,
|
||||
Email);
|
||||
/***** Create alert *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
|
||||
Txt_Email_X_removed,
|
||||
Email);
|
||||
|
||||
/***** Update list of emails *****/
|
||||
Mai_GetEmailFromUsrCod (UsrDat);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1512,10 +1495,10 @@ void Mai_NewOtherUsrEmail (void)
|
|||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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_had_been_registered_by_another_user;
|
||||
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];
|
||||
|
||||
if (Usr_ICanEditOtherUsr (UsrDat))
|
||||
|
@ -1541,23 +1523,17 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
|
|||
/***** Check if new email exists in database *****/
|
||||
if (UsrDat->EmailConfirmed &&
|
||||
!strcmp (UsrDat->Email,NewEmail)) // User's current confirmed email match exactly the new email
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_address_X_matches_one_previously_registered,
|
||||
NewEmail);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_address_X_matches_one_previously_registered,
|
||||
NewEmail);
|
||||
else
|
||||
{
|
||||
if (Mai_UpdateEmailInDB (UsrDat,NewEmail))
|
||||
{
|
||||
/***** Email updated sucessfully *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_address_X_has_been_registered_successfully,
|
||||
NewEmail);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_address_X_has_been_registered_successfully,
|
||||
NewEmail);
|
||||
|
||||
/***** Update list of emails *****/
|
||||
Mai_GetEmailFromUsrCod (UsrDat);
|
||||
|
@ -1568,31 +1544,18 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
|
|||
Mai_SendMailMsgToConfirmEmail ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_address_X_had_been_registered_by_another_user,
|
||||
NewEmail);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_address_X_had_been_registered_by_another_user,
|
||||
NewEmail);
|
||||
}
|
||||
}
|
||||
else // New email is not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_email_address_entered_X_is_not_valid,
|
||||
NewEmail);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_address_entered_X_is_not_valid,
|
||||
NewEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1698,25 +1661,19 @@ bool Mai_SendMailMsgToConfirmEmail (void)
|
|||
{
|
||||
case 0: // Message sent successfully
|
||||
Gbl.Usrs.Me.ConfirmEmailJustSent = true;
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address,
|
||||
Gbl.Usrs.Me.UsrDat.Email);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
|
||||
Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address,
|
||||
Gbl.Usrs.Me.UsrDat.Email);
|
||||
return true;
|
||||
case 1:
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_was_a_problem_sending_an_email_automatically,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,Mai_EMAIL_SECTION_ID,
|
||||
Txt_There_was_a_problem_sending_an_email_automatically);
|
||||
return false;
|
||||
default:
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Gbl.DelayedAlert.Section = Mai_EMAIL_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
"Internal error: an email message has not been sent successfully."
|
||||
" Error code returned by the script: %d",
|
||||
ReturnCode);
|
||||
Ale_CreateAlert (Ale_ERROR,Mai_EMAIL_SECTION_ID,
|
||||
"Internal error: an email message has not been sent successfully."
|
||||
" Error code returned by the script: %d",
|
||||
ReturnCode);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
44
swad_mark.c
44
swad_mark.c
|
@ -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_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];
|
||||
FILE *FileAllMarks;
|
||||
bool EndOfHead = false;
|
||||
|
@ -326,9 +325,8 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
|
|||
// Only one table is allowed
|
||||
if (Str_FindStrInFile (FileAllMarks,"<table",Str_NO_SKIP_HTML_COMMENTS))
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_There_are_more_than_one_table_in_the_file_of_marks,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_There_are_more_than_one_table_in_the_file_of_marks);
|
||||
FileIsCorrect = false;
|
||||
}
|
||||
else
|
||||
|
@ -389,21 +387,14 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
|
|||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Table_not_found_in_the_file_of_marks,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_Table_not_found_in_the_file_of_marks);
|
||||
FileIsCorrect = false;
|
||||
}
|
||||
|
||||
/***** The file of marks is no more necessary. Close it. *****/
|
||||
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;
|
||||
}
|
||||
|
@ -464,9 +455,8 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
/***** Open HTML file with the table of marks *****/
|
||||
if (!(FileAllMarks = fopen (PathFileAllMarks,"rb")))
|
||||
{ // Can't open the file with the table of marks
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Can not open file of marks.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Can not open file of marks.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -601,10 +591,9 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
|
||||
/***** User's ID not found in table *****/
|
||||
fclose (FileAllMarks);
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_THE_USER_X_is_not_found_in_the_file_of_marks,
|
||||
UsrDat->FullName);
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_THE_USER_X_is_not_found_in_the_file_of_marks,
|
||||
UsrDat->FullName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -714,7 +703,7 @@ void Mrk_ShowMyMarks (void)
|
|||
else // Problems in table of marks or user's ID not found
|
||||
{
|
||||
fclose (FileUsrMarks);
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
|
||||
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);
|
||||
if (asprintf (ContentStr,"<![CDATA[%s]]>",
|
||||
Gbl.DelayedAlert.Txt) < 0)
|
||||
Ale_GetTextOfLastAlert ()) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Ale_ResetAllAlerts ();
|
||||
}
|
||||
}
|
||||
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]]>",
|
||||
Gbl.DelayedAlert.Txt) < 0)
|
||||
"Can not open file of marks.") < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
unlink (FileNameUsrMarks); // File with marks is no longer necessary
|
||||
}
|
||||
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]]>",
|
||||
Gbl.DelayedAlert.Txt) < 0)
|
||||
"User's IDs not found!") < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,9 +250,8 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
|
|||
Box_StartBox (StrRecordWidth,Txt_Nickname,Acc_PutLinkToRemoveMyAccount,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show possible alert *****/
|
||||
if (Gbl.DelayedAlert.Section == (const char *) Nck_NICKNAME_SECTION_ID)
|
||||
Ale_ShowDelayedAlert ();
|
||||
/***** Show possible alerts *****/
|
||||
Ale_ShowAlerts (Nck_NICKNAME_SECTION_ID);
|
||||
|
||||
/***** Help message *****/
|
||||
if (IMustFillNickname)
|
||||
|
@ -434,19 +433,13 @@ void Nck_RemoveMyNick (void)
|
|||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NicknameWithoutArroba);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Nickname_X_removed,
|
||||
NicknameWithoutArroba);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||
Txt_Nickname_X_removed,
|
||||
NicknameWithoutArroba);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_can_not_delete_your_current_nickname,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||
Txt_You_can_not_delete_your_current_nickname);
|
||||
|
||||
/***** Show my account again *****/
|
||||
Acc_ShowFormChgMyAccount ();
|
||||
|
@ -474,20 +467,18 @@ void Nck_RemoveOtherUsrNick (void)
|
|||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NicknameWithoutArroba);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_Nickname_X_removed,
|
||||
NicknameWithoutArroba);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||
Txt_Nickname_X_removed,
|
||||
NicknameWithoutArroba);
|
||||
|
||||
/***** Show user's account again *****/
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else // User not found
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -534,10 +525,10 @@ void Nck_UpdateOtherUsrNick (void)
|
|||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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 *****/
|
||||
if (!strcmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname match exactly the new nickname
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
||||
NewNicknameWithoutArroba);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||
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
|
||||
{
|
||||
/***** 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"
|
||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||
NewNicknameWithoutArroba,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_nickname_X_had_been_registered_by_another_user,
|
||||
NewNicknameWithoutArroba);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||
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
|
||||
// and is diffent to the current one
|
||||
|
@ -600,23 +583,17 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
|
|||
Str_Copy (UsrDat->Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_nickname_X_has_been_registered_successfully,
|
||||
NewNicknameWithoutArroba);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||
Txt_The_nickname_X_has_been_registered_successfully,
|
||||
NewNicknameWithoutArroba);
|
||||
}
|
||||
}
|
||||
else // New nickname is not valid
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_nickname_entered_X_is_not_valid_,
|
||||
NewNicknameWithArroba,
|
||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||
Txt_The_nickname_entered_X_is_not_valid_,
|
||||
NewNicknameWithArroba,
|
||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -178,12 +178,8 @@ void Pwd_UpdateMyPwd (void)
|
|||
/***** Check and update new password *****/
|
||||
Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Me.UsrDat);
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_entered_your_password_correctly,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_You_have_not_entered_your_password_correctly);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -199,10 +195,10 @@ void Pwd_UpdateOtherUsrPwd (void)
|
|||
/***** Check and update password *****/
|
||||
Pwd_CheckAndUpdateNewPwd (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
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 *****/
|
||||
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
|
||||
{
|
||||
// Passwords don't match
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_You_have_not_written_twice_the_same_new_password,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_You_have_not_written_twice_the_same_new_password);
|
||||
else
|
||||
{
|
||||
Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword);
|
||||
|
@ -241,10 +233,8 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat)
|
|||
Ses_UpdateSessionDataInDB ();
|
||||
Enr_UpdateUsrData (UsrDat);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_has_been_changed_successfully,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_has_been_changed_successfully);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 *****/
|
||||
if (Pwd_CheckIfPasswdIsUsrIDorName (PlainPassword)) // PlainPassword is a user's ID, name or surname
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_is_too_trivial_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_is_too_trivial_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -536,10 +524,8 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
|
|||
if (Pwd_GetNumOtherUsrsWhoUseThisPassword (EncryptedPassword,UsrCod) >
|
||||
Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_is_too_trivial_,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_is_too_trivial_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -620,21 +606,17 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
|
|||
/***** Check length of password *****/
|
||||
if (LengthPassword < Pwd_MIN_BYTES_PLAIN_PASSWORD) // PlainPassword too short
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Txt_The_password_must_be_at_least_X_characters,
|
||||
Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_must_be_at_least_X_characters,
|
||||
Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
return false;
|
||||
}
|
||||
|
||||
/***** Check spaces in password *****/
|
||||
if (strchr (PlainPassword,(int) ' ') != NULL) // PlainPassword with spaces
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_can_not_contain_spaces,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_can_not_contain_spaces);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -646,10 +628,8 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
|
|||
ItsANumber = false;
|
||||
if (ItsANumber)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Gbl.DelayedAlert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_The_password_can_not_consist_only_of_digits,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_WARNING,Pwd_PASSWORD_SECTION_ID,
|
||||
Txt_The_password_can_not_consist_only_of_digits);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -687,9 +667,8 @@ void Pwd_ShowFormChgMyPwd (void)
|
|||
Box_StartBox (StrRecordWidth,Txt_Password,NULL,
|
||||
Hlp_PROFILE_Password,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show possible alert *****/
|
||||
if (Gbl.DelayedAlert.Section == Pwd_PASSWORD_SECTION_ID)
|
||||
Ale_ShowDelayedAlert ();
|
||||
/***** Show possible alerts *****/
|
||||
Ale_ShowAlerts (Pwd_PASSWORD_SECTION_ID);
|
||||
|
||||
/***** Help message *****/
|
||||
if (!IHaveAPasswordInDB) // If I don't have a password in database...
|
||||
|
@ -851,9 +830,8 @@ void Pwd_ShowFormChgOtherUsrPwd (void)
|
|||
/***** Start section *****/
|
||||
Lay_StartSection (Pwd_PASSWORD_SECTION_ID);
|
||||
|
||||
/***** Show possible alert *****/
|
||||
if (Gbl.DelayedAlert.Section == (const char *) Pwd_PASSWORD_SECTION_ID)
|
||||
Ale_ShowDelayedAlert ();
|
||||
/***** Show possible alerts *****/
|
||||
Ale_ShowAlerts (Pwd_PASSWORD_SECTION_ID);
|
||||
|
||||
/***** Form to change password *****/
|
||||
/* Start form */
|
||||
|
|
42
swad_photo.c
42
swad_photo.c
|
@ -373,10 +373,10 @@ void Pho_SendPhotoUsr (void)
|
|||
Pho_ReqOtherUsrPhoto ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else // User not found
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -413,7 +413,7 @@ void Pho_RecOtherUsrPhotoDetFaces (void)
|
|||
Rec_ShowPublicSharedRecordOtherUsr ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -464,7 +464,7 @@ void Pho_RemoveMyPhoto1 (void)
|
|||
void Pho_RemoveMyPhoto2 (void)
|
||||
{
|
||||
/***** Write success / warning message *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show my record and other data *****/
|
||||
Rec_ShowMySharedRecordAndMore ();
|
||||
|
@ -525,10 +525,10 @@ void Pho_ReqRemoveUsrPhoto (void)
|
|||
Ale_ShowAlert (Ale_INFO,Txt_The_photo_no_longer_exists);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Show another user's record card *****/
|
||||
Rec_ShowPublicSharedRecordOtherUsr ();
|
||||
|
@ -548,10 +548,10 @@ void Pho_RemoveUsrPhoto (void)
|
|||
{
|
||||
/***** Remove photo *****/
|
||||
if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat))
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Show another user's record card *****/
|
||||
Rec_ShowPublicSharedRecordOtherUsr ();
|
||||
|
@ -843,7 +843,7 @@ void Pho_UpdateUsrPhoto1 (void)
|
|||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
Pho_UpdatePhoto1 (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
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 */
|
||||
Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_has_been_updated,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Photo_has_been_updated);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Error updating photo.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Error updating photo.");
|
||||
}
|
||||
|
||||
static void Pho_UpdatePhoto2 (void)
|
||||
|
@ -904,7 +900,7 @@ static void Pho_UpdatePhoto2 (void)
|
|||
unsigned NumPhoto;
|
||||
|
||||
/***** Start alert *****/
|
||||
Ale_ShowAlertAndButton1 (Gbl.DelayedAlert.Type,Gbl.DelayedAlert.Txt);
|
||||
Ale_ShowLastAlertAndButton1 ();
|
||||
|
||||
/***** Show the three images resulting of the processing *****/
|
||||
Tbl_StartTableWide (0);
|
||||
|
@ -1126,16 +1122,14 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
|
|||
|
||||
if (NumErrors)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Error removing photo.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Error removing photo.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Photo_removed,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Photo_removed);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ void Prf_GetUsrDatAndShowUserProfile (void)
|
|||
if (!ProfileShown)
|
||||
{
|
||||
/* Show error message */
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/* Request a user's profile */
|
||||
Prf_RequestUserProfile ();
|
||||
|
|
|
@ -1976,7 +1976,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
|
|||
Usr_FreeListUsrCods (&ListUsrCods);
|
||||
}
|
||||
else // No users found
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Put form to edit project again *****/
|
||||
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);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Free memory of the project *****/
|
||||
Prj_FreeMemProject (&Prj);
|
||||
|
@ -2133,10 +2133,10 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
|||
Prj.Title);
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
||||
/***** Free memory of the project *****/
|
||||
Prj_FreeMemProject (&Prj);
|
||||
|
|
|
@ -1029,7 +1029,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
|
|||
|
||||
/* Show optional alert */
|
||||
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/* Shared record */
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
|
||||
|
@ -1097,7 +1097,7 @@ static void Rec_ShowRecordOneStdCrs (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Show optional alert (result of editing data in course record) *****/
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Start container for this user *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_USR\">");
|
||||
|
@ -1236,7 +1236,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
|
||||
/* Show optional alert */
|
||||
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/* Shared record */
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
|
||||
|
@ -1463,7 +1463,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
|||
|
||||
/* Show optional alert */
|
||||
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
||||
Ale_ShowDelayedAlert ();
|
||||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/* Shared record */
|
||||
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;
|
||||
long OriginalActCod;
|
||||
|
||||
/***** Initialize alert type *****/
|
||||
Gbl.DelayedAlert.Type = Ale_NONE; // Do not show alert
|
||||
|
||||
/***** Get where we came from *****/
|
||||
OriginalActCod = Par_GetParToLong ("OriginalActCod");
|
||||
Gbl.Action.Original = Act_GetActionFromActCod (OriginalActCod);
|
||||
|
@ -1650,9 +1647,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
|
|||
|
||||
/***** Update the record *****/
|
||||
Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,Txt_Student_record_card_in_this_course_has_been_updated,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Student_record_card_in_this_course_has_been_updated);
|
||||
|
||||
/***** Show one or multiple records *****/
|
||||
switch (Gbl.Action.Original)
|
||||
|
|
|
@ -846,11 +846,17 @@ static void Soc_BuildQueryToGetTimeline (char **Query,
|
|||
Soc_AddNotesJustRetrievedToTimelineThisSession ();
|
||||
|
||||
/***** Build query to show timeline including the users I am following *****/
|
||||
DB_BuildQuery_old (Query,
|
||||
"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)"
|
||||
" FROM social_pubs WHERE PubCod IN "
|
||||
"(SELECT PubCod FROM pub_codes)"
|
||||
" ORDER BY PubCod DESC");
|
||||
DB_BuildQuery (Query,
|
||||
"SELECT PubCod," // row[0]
|
||||
"NotCod," // row[1]
|
||||
"PublisherCod," // row[2]
|
||||
"PubType," // row[3]
|
||||
"UNIX_TIMESTAMP(TimePublish)" // row[4]
|
||||
" FROM social_pubs"
|
||||
" WHERE PubCod IN "
|
||||
"(SELECT PubCod"
|
||||
" FROM pub_codes)"
|
||||
" ORDER BY PubCod DESC");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -2708,7 +2708,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
|
|||
/****** Convert invalid characters in a file name to valid characters ********/
|
||||
/*****************************************************************************/
|
||||
// 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
|
||||
|
||||
bool Str_ConvertFilFolLnkNameToValid (char *FileName)
|
||||
|
@ -2799,22 +2799,15 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName)
|
|||
if (NumAlfanum)
|
||||
FileNameIsOK = true;
|
||||
else
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
snprintf (Gbl.DelayedAlert.Txt,sizeof (Gbl.DelayedAlert.Txt),
|
||||
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_X_invalid_name_NO_HTML :
|
||||
Txt_UPLOAD_FILE_X_invalid_name,
|
||||
FileName);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_X_invalid_name_NO_HTML :
|
||||
Txt_UPLOAD_FILE_X_invalid_name,
|
||||
FileName);
|
||||
}
|
||||
else // FileName is empty
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,
|
||||
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML :
|
||||
Txt_UPLOAD_FILE_Invalid_name,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML :
|
||||
Txt_UPLOAD_FILE_Invalid_name);
|
||||
|
||||
return FileNameIsOK;
|
||||
}
|
||||
|
|
|
@ -2645,7 +2645,8 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
|||
if (NumAnswers > Svy_MAX_ANSWERS_PER_QUESTION)
|
||||
Lay_ShowErrorAndExit ("Wrong answer.");
|
||||
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
|
||||
Svy_MAX_BYTES_ANSWER);
|
||||
|
@ -2883,9 +2884,8 @@ static bool Svy_AllocateTextChoiceAnswer (struct SurveyQuestion *SvyQst,
|
|||
Svy_FreeTextChoiceAnswer (SvyQst,NumAns);
|
||||
if ((SvyQst->AnsChoice[NumAns].Text = (char *) malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Not enough memory to store answer.");
|
||||
return false;
|
||||
}
|
||||
SvyQst->AnsChoice[NumAns].Text[0] = '\0';
|
||||
|
@ -2965,7 +2965,8 @@ void Svy_ReceiveQst (void)
|
|||
NumAns++)
|
||||
{
|
||||
if (!Svy_AllocateTextChoiceAnswer (&SvyQst,NumAns))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
snprintf (AnsStr,sizeof (AnsStr),
|
||||
"AnsStr%u",
|
||||
NumAns);
|
||||
|
@ -3396,7 +3397,9 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
|
|||
|
||||
/* Convert the answer (row[2]), that is in HTML, to rigorous HTML */
|
||||
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
|
||||
Svy_MAX_BYTES_ANSWER);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
|
|
60
swad_test.c
60
swad_test.c
|
@ -3724,7 +3724,8 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
|
|||
|
||||
/***** Allocate memory for text in this choice answer *****/
|
||||
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
/***** Assign index (row[0]).
|
||||
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 *****/
|
||||
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 ******/
|
||||
|
@ -4095,7 +4097,8 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
|
|||
|
||||
/***** Allocate memory for text in this choice answer *****/
|
||||
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
/***** Assign index (row[0]).
|
||||
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 *****/
|
||||
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 ******/
|
||||
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 =
|
||||
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store answer.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Not enough memory to store answer.");
|
||||
return 0;
|
||||
}
|
||||
if ((Gbl.Test.Answer.Options[NumOpt].Feedback =
|
||||
(char *) malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Not enough memory to store feedback.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Not enough memory to store feedback.");
|
||||
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)
|
||||
Lay_ShowErrorAndExit ("Wrong answer.");
|
||||
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
Str_Copy (Gbl.Test.Answer.Options[NumOpt].Text,row[1],
|
||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||
|
@ -5858,18 +5861,23 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
{
|
||||
case Tst_ANS_INT:
|
||||
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);
|
||||
break;
|
||||
case Tst_ANS_FLOAT:
|
||||
if (!Tst_AllocateTextChoiceAnswer (0))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
Par_GetParToText ("AnsFloatMin",Gbl.Test.Answer.Options[0].Text,
|
||||
Tst_MAX_BYTES_FLOAT_ANSWER);
|
||||
|
||||
if (!Tst_AllocateTextChoiceAnswer (1))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text,
|
||||
Tst_MAX_BYTES_FLOAT_ANSWER);
|
||||
break;
|
||||
|
@ -5890,7 +5898,8 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
NumOpt++)
|
||||
{
|
||||
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
/* Get answer */
|
||||
snprintf (AnsStr,sizeof (AnsStr),
|
||||
|
@ -6267,31 +6276,24 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
|
|||
"SELECT TagCod FROM tst_tags"
|
||||
" WHERE CrsCod=%ld AND TagTxt='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
|
||||
|
||||
Gbl.DelayedAlert.Type = Ale_NONE;
|
||||
if (NumRows == 1)
|
||||
{
|
||||
/***** Get tag code *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Wrong code of tag.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Wrong code of tag.");
|
||||
}
|
||||
else if (NumRows > 1)
|
||||
{
|
||||
Gbl.DelayedAlert.Type = Ale_ERROR;
|
||||
Str_Copy (Gbl.DelayedAlert.Txt,"Duplicated tag.",
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
Ale_CreateAlert (Ale_ERROR,NULL,
|
||||
"Duplicated tag.");
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
if (Gbl.DelayedAlert.Type == Ale_ERROR)
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/***** Abort on error *****/
|
||||
if (Ale_GetTypeOfLastAlert () == Ale_ERROR)
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
return TagCod;
|
||||
}
|
||||
|
|
|
@ -826,7 +826,8 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
|
|||
{
|
||||
case Tst_ANS_INT:
|
||||
if (!Tst_AllocateTextChoiceAnswer (0))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
if (AnswerElem->Content)
|
||||
Str_Copy (Gbl.Test.Answer.Options[0].Text,AnswerElem->Content,
|
||||
|
@ -834,9 +835,11 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
|
|||
break;
|
||||
case Tst_ANS_FLOAT:
|
||||
if (!Tst_AllocateTextChoiceAnswer (0))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
if (!Tst_AllocateTextChoiceAnswer (1))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
for (LowerUpperElem = AnswerElem->FirstChild;
|
||||
LowerUpperElem != NULL;
|
||||
|
@ -888,7 +891,8 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
|
|||
if (!strcmp (OptionElem->TagName,"option"))
|
||||
{
|
||||
if (!Tst_AllocateTextChoiceAnswer (NumOpt))
|
||||
Lay_ShowErrorAndExit (Gbl.DelayedAlert.Txt);
|
||||
/* Abort on error */
|
||||
Ale_ShowAlertsAndExit ();
|
||||
|
||||
for (TextElem = OptionElem->FirstChild;
|
||||
TextElem != NULL;
|
||||
|
|
716
swad_user.c
716
swad_user.c
|
@ -2957,7 +2957,7 @@ void Usr_ChkUsrAndGetUsrData (void)
|
|||
|
||||
/* Send message via email to confirm the new email address */
|
||||
Mai_SendMailMsgToConfirmEmail ();
|
||||
Ale_ShowDelayedAlert (); // Show alert after sending email confirmation
|
||||
Ale_ShowAlerts (NULL); // Show alert after sending email confirmation
|
||||
}
|
||||
}
|
||||
else // Gbl.Action.Act != ActCreUsrAcc
|
||||
|
@ -4513,96 +4513,96 @@ void Usr_GetListUsrs (Sco_Scope_t Scope,Rol_Role_t Role)
|
|||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
/* Get users in courses from the whole platform */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
/* Get users in courses from the current country */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres,institutions"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres,institutions"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
/* Get users in courses from the current institution */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees,centres"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
/* Get users in courses from the current centre */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses,degrees"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
/* Get users in courses from the current degree */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM usr_data,crs_usr,courses"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
QueryFields,
|
||||
(unsigned) Role,
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
/* Get users from the current course */
|
||||
|
@ -4673,81 +4673,81 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
/* Search users from the whole platform */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,usr_data"
|
||||
" WHERE %s",
|
||||
QueryFields,OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,usr_data"
|
||||
" WHERE %s",
|
||||
QueryFields,OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
/* Search users in courses from the current country */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
/* Search users in courses from the current institution */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
/* Search users in courses from the current centre */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
/* Search users in courses from the current degree */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
/* Search users in courses from the current course */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
default:
|
||||
Lay_WrongScopeExit ();
|
||||
|
@ -4756,13 +4756,13 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
break;
|
||||
case Rol_GST: // Guests (scope is not used)
|
||||
/* Search users with no courses */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,usr_data"
|
||||
" WHERE candidate_users.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,usr_data"
|
||||
" WHERE candidate_users.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Rol_STD: // Student
|
||||
case Rol_NET: // Non-editing teacher
|
||||
|
@ -4791,95 +4791,95 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
/* Search users in courses from the whole platform */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
/* Search users in courses from the current country */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
/* Search users in courses from the current institution */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
/* Search users in courses from the current centre */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
/* Search users in courses from the current degree */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
/* Search users in courses from the current course */
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
OrderQuery);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s,crs_usr.Role,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
OrderQuery);
|
||||
break;
|
||||
default:
|
||||
Lay_WrongScopeExit ();
|
||||
|
@ -4975,123 +4975,123 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
|
|||
switch (Scope)
|
||||
{
|
||||
case Sco_SCOPE_SYS: // All admins
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT DISTINCT UsrCod FROM admin)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT DISTINCT UsrCod FROM admin)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields);
|
||||
break;
|
||||
case Sco_SCOPE_CTY: // System admins
|
||||
// and admins of the institutions, centres and degrees in the current country
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentCty.Cty.CtyCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCty.Cty.CtyCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCty.Cty.CtyCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres,institutions"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentCty.Cty.CtyCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCty.Cty.CtyCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS: // System admins,
|
||||
// admins of the current institution,
|
||||
// and admins of the centres and degrees in the current institution
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentIns.Ins.InsCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees,centres"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR: // System admins,
|
||||
// admins of the current institution,
|
||||
// admins and the current centre,
|
||||
// and admins of the degrees in the current centre
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT admin.UsrCod FROM admin,degrees"
|
||||
" WHERE admin.Scope='%s'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG: // System admins
|
||||
// and admins of the current institution, centre or degree
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentDeg.Deg.DegCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s')"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT UsrCod FROM admin"
|
||||
" WHERE Scope='%s' AND Cod=%ld)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Sco_ScopeDB[Sco_SCOPE_SYS],
|
||||
Sco_ScopeDB[Sco_SCOPE_INS],Gbl.CurrentIns.Ins.InsCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_CTR],Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
Sco_ScopeDB[Sco_SCOPE_DEG],Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
default: // not aplicable
|
||||
Lay_WrongScopeExit ();
|
||||
|
@ -5139,39 +5139,39 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
|
|||
switch (Scope)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE (CtyCod=%ld OR InsCtyCod=%ld)"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE (CtyCod=%ld OR InsCtyCod=%ld)"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentCty.Cty.CtyCod,
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE InsCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE InsCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE CtrCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM usr_data"
|
||||
" WHERE CtrCod=%ld"
|
||||
" AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
|
||||
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
|
||||
QueryFields,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
default: // not aplicable
|
||||
return;
|
||||
|
@ -5219,14 +5219,14 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod)
|
|||
if (Usr_GetNumUsrsInCrssOfDeg (Rol_STD,DegCod))
|
||||
{
|
||||
/***** Get the students in a degree from database *****/
|
||||
DB_BuildQuery_old (&Query,
|
||||
"SELECT %s FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||
QueryFields,
|
||||
DegCod,(unsigned) Rol_STD);
|
||||
DB_BuildQuery (&Query,
|
||||
"SELECT %s FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod=%ld"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||
QueryFields,
|
||||
DegCod,(unsigned) Rol_STD);
|
||||
|
||||
/***** Get list of students from database *****/
|
||||
Usr_GetListUsrsFromQuery (Query,Rol_STD,Sco_SCOPE_DEG);
|
||||
|
@ -9119,7 +9119,7 @@ void Usr_PrintUsrQRCode (void)
|
|||
Box_EndBox ();
|
||||
}
|
||||
else
|
||||
Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue