mirror of https://github.com/acanas/swad-core.git
Version18.69.2
This commit is contained in:
parent
c19a436f2f
commit
49d5db793d
61
swad_alert.c
61
swad_alert.c
|
@ -137,7 +137,7 @@ const char *Ale_GetTextOfLastAlert (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************* Reset alerts ********************************/
|
/***************************** Reset all alerts ******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ale_ResetAllAlerts (void)
|
void Ale_ResetAllAlerts (void)
|
||||||
|
@ -150,12 +150,20 @@ void Ale_ResetAllAlerts (void)
|
||||||
Ale_ResetAlert (i);
|
Ale_ResetAlert (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************* Reset more recent alert ***************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ale_ResetLastAlert (void)
|
static void Ale_ResetLastAlert (void)
|
||||||
{
|
{
|
||||||
if (Gbl.Alerts.Num) // There are pending alerts no shown
|
if (Gbl.Alerts.Num) // There are pending alerts no shown
|
||||||
Ale_ResetAlert (Gbl.Alerts.Num - 1); // Reset the last one
|
Ale_ResetAlert (Gbl.Alerts.Num - 1); // Reset the last one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************* Reset one alert given its index ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ale_ResetAlert (size_t i)
|
static void Ale_ResetAlert (size_t i)
|
||||||
{
|
{
|
||||||
bool NoMoreAlertsPending;
|
bool NoMoreAlertsPending;
|
||||||
|
@ -201,7 +209,7 @@ void Ale_ShowAlertsAndExit ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************************** Show alert messages ****************************/
|
/****** Show several alert messages stored in vector of delayed alerts *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// If Section == NULL ==> show all alerts
|
// If Section == NULL ==> show all alerts
|
||||||
// If Section != NULL ==> shown only the alerts assigned to Section
|
// If Section != NULL ==> shown only the alerts assigned to Section
|
||||||
|
@ -228,6 +236,10 @@ void Ale_ShowAlerts (const char *Section)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Show one formatted-text alert message ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
|
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -253,6 +265,10 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Show one fix-text alert message **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt)
|
static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt)
|
||||||
{
|
{
|
||||||
if (AlertType != Ale_NONE)
|
if (AlertType != Ale_NONE)
|
||||||
|
@ -264,6 +280,10 @@ static void Ale_ShowFixAlert (Ale_AlertType_t AlertType,const char *Txt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Show the more recent alert with a button *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
const char *OnSubmit,void (*FuncParams) (),
|
const char *OnSubmit,void (*FuncParams) (),
|
||||||
Btn_Button_t Button,const char *TxtButton)
|
Btn_Button_t Button,const char *TxtButton)
|
||||||
|
@ -276,6 +296,23 @@ void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
FuncParams,Button,TxtButton);
|
FuncParams,Button,TxtButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********** Show the first part of more recent alert with a button ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Ale_ShowLastAlertAndButton1 (void)
|
||||||
|
{
|
||||||
|
/***** Show last alert *****/
|
||||||
|
Ale_ShowFixAlertAndButton1 (Ale_GetTypeOfLastAlert (),Ale_GetTextOfLastAlert ());
|
||||||
|
|
||||||
|
/***** Reset last alert *****/
|
||||||
|
Ale_ResetLastAlert ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********************** Show an alert with a button *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
const char *OnSubmit,void (*FuncParams) (),
|
const char *OnSubmit,void (*FuncParams) (),
|
||||||
Btn_Button_t Button,const char *TxtButton,
|
Btn_Button_t Button,const char *TxtButton,
|
||||||
|
@ -303,14 +340,9 @@ void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
free ((void *) Txt);
|
free ((void *) Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ale_ShowLastAlertAndButton1 (void)
|
/*****************************************************************************/
|
||||||
{
|
/******** Show the first part of a formatted-text alert with a button ********/
|
||||||
/***** Show last alert *****/
|
/*****************************************************************************/
|
||||||
Ale_ShowFixAlertAndButton1 (Ale_GetTypeOfLastAlert (),Ale_GetTextOfLastAlert ());
|
|
||||||
|
|
||||||
/***** Reset last alert *****/
|
|
||||||
Ale_ResetLastAlert ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...)
|
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...)
|
||||||
{
|
{
|
||||||
|
@ -334,6 +366,10 @@ void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...)
|
||||||
free ((void *) Txt);
|
free ((void *) Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Show the first part of a fix-text alert with a button ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
|
static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Close;
|
extern const char *Txt_Close;
|
||||||
|
@ -388,6 +424,10 @@ static void Ale_ShowFixAlertAndButton1 (Ale_AlertType_t AlertType,const char *Tx
|
||||||
Txt);
|
Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************** Show the second part of an alert with a button **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
||||||
void (*FuncParams) (),
|
void (*FuncParams) (),
|
||||||
Btn_Button_t Button,const char *TxtButton)
|
Btn_Button_t Button,const char *TxtButton)
|
||||||
|
@ -438,4 +478,3 @@ void Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (void)
|
||||||
|
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,11 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *fmt,...);
|
||||||
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
void Ale_ShowLastAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
const char *OnSubmit,void (*FuncParams) (),
|
const char *OnSubmit,void (*FuncParams) (),
|
||||||
Btn_Button_t Button,const char *TxtButton);
|
Btn_Button_t Button,const char *TxtButton);
|
||||||
|
void Ale_ShowLastAlertAndButton1 (void);
|
||||||
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
void Ale_ShowAlertAndButton (Act_Action_t NextAction,const char *Anchor,
|
||||||
const char *OnSubmit,void (*FuncParams) (),
|
const char *OnSubmit,void (*FuncParams) (),
|
||||||
Btn_Button_t Button,const char *TxtButton,
|
Btn_Button_t Button,const char *TxtButton,
|
||||||
Ale_AlertType_t AlertType,const char *fmt,...);
|
Ale_AlertType_t AlertType,const char *fmt,...);
|
||||||
void Ale_ShowLastAlertAndButton1 (void);
|
|
||||||
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...);
|
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *fmt,...);
|
||||||
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
|
||||||
void (*FuncParams) (),
|
void (*FuncParams) (),
|
||||||
|
|
|
@ -447,10 +447,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.69.1 (2019-03-09)"
|
#define Log_PLATFORM_VERSION "SWAD 18.69.2 (2019-03-10)"
|
||||||
#define CSS_FILE "swad18.68.3.css"
|
#define CSS_FILE "swad18.68.3.css"
|
||||||
#define JS_FILE "swad18.64.js"
|
#define JS_FILE "swad18.64.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.69.2: Mar 10, 2019 Changes related to alerts. (238842 lines)
|
||||||
Version 18.69.1: Mar 09, 2019 Changes in forms to register/remove users. (238805 lines)
|
Version 18.69.1: Mar 09, 2019 Changes in forms to register/remove users. (238805 lines)
|
||||||
Version 18.69: Mar 09, 2019 Code refactoring related to alerts. (238779 lines)
|
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.
|
Version 18.68.3: Mar 08, 2019 Changes in styles of connected users.
|
||||||
|
|
|
@ -3808,8 +3808,9 @@ void Enr_CreateNewUsr2 (void)
|
||||||
Ale_ShowAlerts (NULL);
|
Ale_ShowAlerts (NULL);
|
||||||
else // User's ID valid
|
else // User's ID valid
|
||||||
{
|
{
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
// if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
||||||
Ale_ShowAlerts (NULL);
|
/***** Show possible alerts *****/
|
||||||
|
Ale_ShowAlerts (NULL);
|
||||||
|
|
||||||
/***** Show user's record *****/
|
/***** Show user's record *****/
|
||||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||||
|
@ -3980,10 +3981,10 @@ void Enr_ModifyUsr2 (void)
|
||||||
{
|
{
|
||||||
if (Ale_GetTypeOfLastAlert () == Ale_WARNING)
|
if (Ale_GetTypeOfLastAlert () == Ale_WARNING)
|
||||||
{
|
{
|
||||||
/* Show possible alerts */
|
/***** Show possible alerts *****/
|
||||||
Ale_ShowAlerts (NULL);
|
Ale_ShowAlerts (NULL);
|
||||||
|
|
||||||
/* Show form to edit user again */
|
/***** Show form to edit user again *****/
|
||||||
Enr_ShowFormToEditOtherUsr ();
|
Enr_ShowFormToEditOtherUsr ();
|
||||||
}
|
}
|
||||||
else // No error
|
else // No error
|
||||||
|
@ -3991,10 +3992,10 @@ void Enr_ModifyUsr2 (void)
|
||||||
{
|
{
|
||||||
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
|
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
|
||||||
// if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
// if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
/* Show possible alerts */
|
/***** Show possible alerts *****/
|
||||||
Ale_ShowAlerts (NULL);
|
Ale_ShowAlerts (NULL);
|
||||||
|
|
||||||
/* Show form to edit user again */
|
/***** Show form to edit user again *****/
|
||||||
Enr_ShowFormToEditOtherUsr ();
|
Enr_ShowFormToEditOtherUsr ();
|
||||||
break;
|
break;
|
||||||
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
||||||
|
|
|
@ -1054,11 +1054,15 @@ void Fol_FollowUsr1 (void)
|
||||||
void Fol_FollowUsr2 (void)
|
void Fol_FollowUsr2 (void)
|
||||||
{
|
{
|
||||||
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS)
|
||||||
|
{
|
||||||
/***** Show user's profile again *****/
|
/***** Show user's profile again *****/
|
||||||
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
||||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
/* 1) I had permission to follow the user and I've just follow him/her
|
||||||
|
2) User restricted permission, so now I can not view his/her profile
|
||||||
if (Ale_GetTypeOfLastAlert () != Ale_SUCCESS)
|
3) Now I can not view his/her profile ==> show users I follow */
|
||||||
|
Fol_ListFollowingUsr (&Gbl.Usrs.Me.UsrDat); // List users I follow
|
||||||
|
}
|
||||||
|
else
|
||||||
Ale_ShowAlerts (NULL);
|
Ale_ShowAlerts (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue