mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-16 13:44:06 +02:00
Version 18.8.13
This commit is contained in:
parent
d90d736fa8
commit
b60c71b5a6
|
@ -1359,7 +1359,6 @@ void Agd_RemoveEvent (void)
|
||||||
void Agd_HideEvent (void)
|
void Agd_HideEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_hidden;
|
extern const char *Txt_Event_X_is_now_hidden;
|
||||||
char *Query;
|
|
||||||
struct AgendaEvent AgdEvent;
|
struct AgendaEvent AgdEvent;
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
|
@ -1371,11 +1370,10 @@ void Agd_HideEvent (void)
|
||||||
Agd_GetDataOfEventByCod (&AgdEvent);
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||||
|
|
||||||
/***** Set event private *****/
|
/***** Set event private *****/
|
||||||
if (asprintf (&Query,"UPDATE agendas SET Hidden='Y'"
|
DB_BuildQuery ("UPDATE agendas SET Hidden='Y'"
|
||||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||||
AgdEvent.AgdCod,AgdEvent.UsrCod) < 0)
|
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide event");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide event");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1394,7 +1392,6 @@ void Agd_HideEvent (void)
|
||||||
void Agd_UnhideEvent (void)
|
void Agd_UnhideEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_visible;
|
extern const char *Txt_Event_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct AgendaEvent AgdEvent;
|
struct AgendaEvent AgdEvent;
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
|
@ -1406,11 +1403,10 @@ void Agd_UnhideEvent (void)
|
||||||
Agd_GetDataOfEventByCod (&AgdEvent);
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||||
|
|
||||||
/***** Set event public *****/
|
/***** Set event public *****/
|
||||||
if (asprintf (&Query,"UPDATE agendas SET Hidden='N'"
|
DB_BuildQuery ("UPDATE agendas SET Hidden='N'"
|
||||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||||
AgdEvent.AgdCod,AgdEvent.UsrCod) < 0)
|
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not show event");
|
||||||
DB_QueryUPDATE_free (Query,"can not show event");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1429,7 +1425,6 @@ void Agd_UnhideEvent (void)
|
||||||
void Agd_MakeEventPrivate (void)
|
void Agd_MakeEventPrivate (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_private;
|
extern const char *Txt_Event_X_is_now_private;
|
||||||
char *Query;
|
|
||||||
struct AgendaEvent AgdEvent;
|
struct AgendaEvent AgdEvent;
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
|
@ -1441,11 +1436,10 @@ void Agd_MakeEventPrivate (void)
|
||||||
Agd_GetDataOfEventByCod (&AgdEvent);
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||||
|
|
||||||
/***** Make event private *****/
|
/***** Make event private *****/
|
||||||
if (asprintf (&Query,"UPDATE agendas SET Public='N'"
|
DB_BuildQuery ("UPDATE agendas SET Public='N'"
|
||||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||||
AgdEvent.AgdCod,AgdEvent.UsrCod) < 0)
|
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not make event private");
|
||||||
DB_QueryUPDATE_free (Query,"can not make event private");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1464,7 +1458,6 @@ void Agd_MakeEventPrivate (void)
|
||||||
void Agd_MakeEventPublic (void)
|
void Agd_MakeEventPublic (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
|
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
|
||||||
char *Query;
|
|
||||||
struct AgendaEvent AgdEvent;
|
struct AgendaEvent AgdEvent;
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
|
@ -1476,11 +1469,10 @@ void Agd_MakeEventPublic (void)
|
||||||
Agd_GetDataOfEventByCod (&AgdEvent);
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||||
|
|
||||||
/***** Make event public *****/
|
/***** Make event public *****/
|
||||||
if (asprintf (&Query,"UPDATE agendas SET Public='Y'"
|
DB_BuildQuery ("UPDATE agendas SET Public='Y'"
|
||||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||||
AgdEvent.AgdCod,AgdEvent.UsrCod) < 0)
|
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not make event public");
|
||||||
DB_QueryUPDATE_free (Query,"can not make event public");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1735,20 +1727,17 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
||||||
|
|
||||||
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the data of the event *****/
|
/***** Update the data of the event *****/
|
||||||
if (asprintf (&Query,"UPDATE agendas SET "
|
DB_BuildQuery ("UPDATE agendas SET "
|
||||||
"StartTime=FROM_UNIXTIME(%ld),"
|
"StartTime=FROM_UNIXTIME(%ld),"
|
||||||
"EndTime=FROM_UNIXTIME(%ld),"
|
"EndTime=FROM_UNIXTIME(%ld),"
|
||||||
"Event='%s',Location='%s',Txt='%s'"
|
"Event='%s',Location='%s',Txt='%s'"
|
||||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||||
AgdEvent->TimeUTC[Agd_START_TIME],
|
AgdEvent->TimeUTC[Agd_START_TIME],
|
||||||
AgdEvent->TimeUTC[Agd_END_TIME ],
|
AgdEvent->TimeUTC[Agd_END_TIME ],
|
||||||
AgdEvent->Event,AgdEvent->Location,Txt,
|
AgdEvent->Event,AgdEvent->Location,Txt,
|
||||||
AgdEvent->AgdCod,AgdEvent->UsrCod) < 0)
|
AgdEvent->AgdCod,AgdEvent->UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update event");
|
||||||
DB_QueryUPDATE_free (Query,"can not update event");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -527,18 +527,16 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
|
||||||
|
|
||||||
void Ann_HideActiveAnnouncement (void)
|
void Ann_HideActiveAnnouncement (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long AnnCod;
|
long AnnCod;
|
||||||
|
|
||||||
/***** Get the code of the global announcement to hide *****/
|
/***** Get the code of the global announcement to hide *****/
|
||||||
AnnCod = Ann_GetParamAnnCod ();
|
AnnCod = Ann_GetParamAnnCod ();
|
||||||
|
|
||||||
/***** Set global announcement as hidden *****/
|
/***** Set global announcement as hidden *****/
|
||||||
if (asprintf (&Query,"UPDATE announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE announcements SET Status=%u"
|
||||||
" WHERE AnnCod=%ld",
|
" WHERE AnnCod=%ld",
|
||||||
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod) < 0)
|
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -547,18 +545,16 @@ void Ann_HideActiveAnnouncement (void)
|
||||||
|
|
||||||
void Ann_RevealHiddenAnnouncement (void)
|
void Ann_RevealHiddenAnnouncement (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long AnnCod;
|
long AnnCod;
|
||||||
|
|
||||||
/***** Get the code of the global announcement to show *****/
|
/***** Get the code of the global announcement to show *****/
|
||||||
AnnCod = Ann_GetParamAnnCod ();
|
AnnCod = Ann_GetParamAnnCod ();
|
||||||
|
|
||||||
/***** Set global announcement as shown *****/
|
/***** Set global announcement as shown *****/
|
||||||
if (asprintf (&Query,"UPDATE announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE announcements SET Status=%u"
|
||||||
" WHERE AnnCod=%ld",
|
" WHERE AnnCod=%ld",
|
||||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod) < 0)
|
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not reveal announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not reveal announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1030,7 +1030,6 @@ void Asg_RemoveAssignment (void)
|
||||||
void Asg_HideAssignment (void)
|
void Asg_HideAssignment (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Assignment_X_is_now_hidden;
|
extern const char *Txt_Assignment_X_is_now_hidden;
|
||||||
char *Query;
|
|
||||||
struct Assignment Asg;
|
struct Assignment Asg;
|
||||||
|
|
||||||
/***** Get assignment code *****/
|
/***** Get assignment code *****/
|
||||||
|
@ -1041,11 +1040,10 @@ void Asg_HideAssignment (void)
|
||||||
Asg_GetDataOfAssignmentByCod (&Asg);
|
Asg_GetDataOfAssignmentByCod (&Asg);
|
||||||
|
|
||||||
/***** Hide assignment *****/
|
/***** Hide assignment *****/
|
||||||
if (asprintf (&Query,"UPDATE assignments SET Hidden='Y'"
|
DB_BuildQuery ("UPDATE assignments SET Hidden='Y'"
|
||||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide assignment");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide assignment");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1064,7 +1062,6 @@ void Asg_HideAssignment (void)
|
||||||
void Asg_ShowAssignment (void)
|
void Asg_ShowAssignment (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Assignment_X_is_now_visible;
|
extern const char *Txt_Assignment_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct Assignment Asg;
|
struct Assignment Asg;
|
||||||
|
|
||||||
/***** Get assignment code *****/
|
/***** Get assignment code *****/
|
||||||
|
@ -1075,11 +1072,10 @@ void Asg_ShowAssignment (void)
|
||||||
Asg_GetDataOfAssignmentByCod (&Asg);
|
Asg_GetDataOfAssignmentByCod (&Asg);
|
||||||
|
|
||||||
/***** Hide assignment *****/
|
/***** Hide assignment *****/
|
||||||
if (asprintf (&Query,"UPDATE assignments SET Hidden='N'"
|
DB_BuildQuery ("UPDATE assignments SET Hidden='N'"
|
||||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not show assignment");
|
||||||
DB_QueryUPDATE_free (Query,"can not show assignment");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1465,14 +1461,11 @@ void Asg_RecFormAssignment (void)
|
||||||
|
|
||||||
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail)
|
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
/***** Update number of users notified *****/
|
||||||
if (asprintf (&Query,"UPDATE assignments SET NumNotif=NumNotif+%u"
|
DB_BuildQuery ("UPDATE assignments SET NumNotif=NumNotif+%u"
|
||||||
" WHERE AsgCod=%ld",
|
" WHERE AsgCod=%ld",
|
||||||
NumUsrsToBeNotifiedByEMail,AsgCod) < 0)
|
NumUsrsToBeNotifiedByEMail,AsgCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the number of notifications of an assignment");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the number of notifications of an assignment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1507,22 +1500,19 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
|
|
||||||
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the data of the assignment *****/
|
/***** Update the data of the assignment *****/
|
||||||
if (asprintf (&Query,"UPDATE assignments SET "
|
DB_BuildQuery ("UPDATE assignments SET "
|
||||||
"StartTime=FROM_UNIXTIME(%ld),"
|
"StartTime=FROM_UNIXTIME(%ld),"
|
||||||
"EndTime=FROM_UNIXTIME(%ld),"
|
"EndTime=FROM_UNIXTIME(%ld),"
|
||||||
"Title='%s',Folder='%s',Txt='%s'"
|
"Title='%s',Folder='%s',Txt='%s'"
|
||||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||||
Asg->TimeUTC[Dat_START_TIME],
|
Asg->TimeUTC[Dat_START_TIME],
|
||||||
Asg->TimeUTC[Dat_END_TIME ],
|
Asg->TimeUTC[Dat_END_TIME ],
|
||||||
Asg->Title,
|
Asg->Title,
|
||||||
Asg->Folder,
|
Asg->Folder,
|
||||||
Txt,
|
Txt,
|
||||||
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update assignment");
|
||||||
DB_QueryUPDATE_free (Query,"can not update assignment");
|
|
||||||
|
|
||||||
/***** Update groups *****/
|
/***** Update groups *****/
|
||||||
/* Remove old groups */
|
/* Remove old groups */
|
||||||
|
|
|
@ -959,7 +959,6 @@ void Att_RemoveAttEventFromDB (long AttCod)
|
||||||
void Att_HideAttEvent (void)
|
void Att_HideAttEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_hidden;
|
extern const char *Txt_Event_X_is_now_hidden;
|
||||||
char *Query;
|
|
||||||
struct AttendanceEvent Att;
|
struct AttendanceEvent Att;
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
|
@ -970,11 +969,10 @@ void Att_HideAttEvent (void)
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
||||||
|
|
||||||
/***** Hide attendance event *****/
|
/***** Hide attendance event *****/
|
||||||
if (asprintf (&Query,"UPDATE att_events SET Hidden='Y'"
|
DB_BuildQuery ("UPDATE att_events SET Hidden='Y'"
|
||||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide attendance event");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide attendance event");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -993,7 +991,6 @@ void Att_HideAttEvent (void)
|
||||||
void Att_ShowAttEvent (void)
|
void Att_ShowAttEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Event_X_is_now_visible;
|
extern const char *Txt_Event_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct AttendanceEvent Att;
|
struct AttendanceEvent Att;
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
|
@ -1004,11 +1001,10 @@ void Att_ShowAttEvent (void)
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
||||||
|
|
||||||
/***** Hide attendance event *****/
|
/***** Hide attendance event *****/
|
||||||
if (asprintf (&Query,"UPDATE att_events SET Hidden='N'"
|
DB_BuildQuery ("UPDATE att_events SET Hidden='N'"
|
||||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not show attendance event");
|
||||||
DB_QueryUPDATE_free (Query,"can not show attendance event");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1378,26 +1374,23 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
||||||
|
|
||||||
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the data of the attendance event *****/
|
/***** Update the data of the attendance event *****/
|
||||||
if (asprintf (&Query,"UPDATE att_events SET "
|
DB_BuildQuery ("UPDATE att_events SET "
|
||||||
"Hidden='%c',"
|
"Hidden='%c',"
|
||||||
"StartTime=FROM_UNIXTIME(%ld),"
|
"StartTime=FROM_UNIXTIME(%ld),"
|
||||||
"EndTime=FROM_UNIXTIME(%ld),"
|
"EndTime=FROM_UNIXTIME(%ld),"
|
||||||
"CommentTchVisible='%c',Title='%s',Txt='%s'"
|
"CommentTchVisible='%c',Title='%s',Txt='%s'"
|
||||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||||
Att->Hidden ? 'Y' :
|
Att->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Att->TimeUTC[Att_START_TIME],
|
Att->TimeUTC[Att_START_TIME],
|
||||||
Att->TimeUTC[Att_END_TIME ],
|
Att->TimeUTC[Att_END_TIME ],
|
||||||
Att->CommentTchVisible ? 'Y' :
|
Att->CommentTchVisible ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Att->Title,
|
Att->Title,
|
||||||
Txt,
|
Txt,
|
||||||
Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update attendance event");
|
||||||
DB_QueryUPDATE_free (Query,"can not update attendance event");
|
|
||||||
|
|
||||||
/***** Update groups *****/
|
/***** Update groups *****/
|
||||||
/* Remove old groups */
|
/* Remove old groups */
|
||||||
|
@ -2584,7 +2577,6 @@ static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long Us
|
||||||
void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
|
void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
|
||||||
{
|
{
|
||||||
bool Present;
|
bool Present;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Check if user is already in table att_usr (present or not) *****/
|
/***** Check if user is already in table att_usr (present or not) *****/
|
||||||
if (Att_CheckIfUsrIsInTableAttUsr (AttCod,UsrCod,&Present)) // User is in table att_usr
|
if (Att_CheckIfUsrIsInTableAttUsr (AttCod,UsrCod,&Present)) // User is in table att_usr
|
||||||
|
@ -2593,11 +2585,10 @@ void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
|
||||||
if (!Present)
|
if (!Present)
|
||||||
{
|
{
|
||||||
/***** Set user as present in database *****/
|
/***** Set user as present in database *****/
|
||||||
if (asprintf (&Query,"UPDATE att_usr SET Present='Y'"
|
DB_BuildQuery ("UPDATE att_usr SET Present='Y'"
|
||||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||||
AttCod,UsrCod) < 0)
|
AttCod,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set user as present in an event");
|
||||||
DB_QueryUPDATE_free (Query,"can not set user as present in an event");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // User is not in table att_usr
|
else // User is not in table att_usr
|
||||||
|
|
|
@ -73,7 +73,8 @@ static void Ban_ShowOrHideBanner (bool Hide);
|
||||||
|
|
||||||
static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName);
|
static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName);
|
||||||
static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,long BanCod);
|
static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,long BanCod);
|
||||||
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,const char *NewBanName);
|
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
|
||||||
|
const char *NewBanName);
|
||||||
|
|
||||||
static void Ban_PutFormToCreateBanner (void);
|
static void Ban_PutFormToCreateBanner (void);
|
||||||
static void Ban_PutHeadBanners (void);
|
static void Ban_PutHeadBanners (void);
|
||||||
|
@ -562,7 +563,6 @@ static void Ban_ShowOrHideBanner (bool Hide)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_banner_X_is_now_hidden;
|
extern const char *Txt_The_banner_X_is_now_hidden;
|
||||||
extern const char *Txt_The_banner_X_is_now_visible;
|
extern const char *Txt_The_banner_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct Banner Ban;
|
struct Banner Ban;
|
||||||
|
|
||||||
/***** Get banner code *****/
|
/***** Get banner code *****/
|
||||||
|
@ -575,13 +575,12 @@ static void Ban_ShowOrHideBanner (bool Hide)
|
||||||
/***** Mark file as hidden/visible in database *****/
|
/***** Mark file as hidden/visible in database *****/
|
||||||
if (Ban.Hidden != Hide)
|
if (Ban.Hidden != Hide)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE banners SET Hidden='%c'"
|
DB_BuildQuery ("UPDATE banners SET Hidden='%c'"
|
||||||
" WHERE BanCod=%ld",
|
" WHERE BanCod=%ld",
|
||||||
Hide ? 'Y' :
|
Hide ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Ban.BanCod) < 0)
|
Ban.BanCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not change status of a banner in database");
|
||||||
DB_QueryUPDATE_free (Query,"can not change status of a banner in database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
|
@ -724,15 +723,13 @@ static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,
|
||||||
/***************** Update banner name in table of banners ********************/
|
/***************** Update banner name in table of banners ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,const char *NewBanName)
|
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
|
||||||
|
const char *NewBanName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update banner changing old name by new name *****/
|
/***** Update banner changing old name by new name *****/
|
||||||
if (asprintf (&Query,"UPDATE banners SET %s='%s' WHERE BanCod=%ld",
|
DB_BuildQuery ("UPDATE banners SET %s='%s' WHERE BanCod=%ld",
|
||||||
FieldName,NewBanName,BanCod) < 0)
|
FieldName,NewBanName,BanCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a banner");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a banner");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -744,7 +741,6 @@ void Ban_ChangeBannerImg (void)
|
||||||
extern const char *Txt_The_new_image_is_X;
|
extern const char *Txt_The_new_image_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_image_empty;
|
extern const char *Txt_You_can_not_leave_the_image_empty;
|
||||||
struct Banner *Ban;
|
struct Banner *Ban;
|
||||||
char *Query;
|
|
||||||
char NewImg[Ban_MAX_BYTES_IMAGE + 1];
|
char NewImg[Ban_MAX_BYTES_IMAGE + 1];
|
||||||
|
|
||||||
Ban = &Gbl.Banners.EditingBan;
|
Ban = &Gbl.Banners.EditingBan;
|
||||||
|
@ -761,10 +757,9 @@ void Ban_ChangeBannerImg (void)
|
||||||
if (NewImg[0])
|
if (NewImg[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old image by new image */
|
/* Update the table changing old image by new image */
|
||||||
if (asprintf (&Query,"UPDATE banners SET Img='%s' WHERE BanCod=%ld",
|
DB_BuildQuery ("UPDATE banners SET Img='%s' WHERE BanCod=%ld",
|
||||||
NewImg,Ban->BanCod) < 0)
|
NewImg,Ban->BanCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the image of a banner");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the image of a banner");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -791,7 +786,6 @@ void Ban_ChangeBannerWWW (void)
|
||||||
extern const char *Txt_The_new_web_address_is_X;
|
extern const char *Txt_The_new_web_address_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||||
struct Banner *Ban;
|
struct Banner *Ban;
|
||||||
char *Query;
|
|
||||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
|
|
||||||
Ban = &Gbl.Banners.EditingBan;
|
Ban = &Gbl.Banners.EditingBan;
|
||||||
|
@ -808,10 +802,9 @@ void Ban_ChangeBannerWWW (void)
|
||||||
if (NewWWW[0])
|
if (NewWWW[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old WWW by new WWW */
|
/* Update the table changing old WWW by new WWW */
|
||||||
if (asprintf (&Query,"UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
|
DB_BuildQuery ("UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
|
||||||
NewWWW,Ban->BanCod) < 0)
|
NewWWW,Ban->BanCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of a banner");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of a banner");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -146,20 +146,17 @@ void Cal_ShowFormToSelFirstDayOfWeek (Act_Action_t Action,void (*FuncParams) (),
|
||||||
|
|
||||||
void Cal_ChangeFirstDayOfWeek (void)
|
void Cal_ChangeFirstDayOfWeek (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with icon set *****/
|
/***** Get param with icon set *****/
|
||||||
Gbl.Prefs.FirstDayOfWeek = Cal_GetParamFirstDayOfWeek ();
|
Gbl.Prefs.FirstDayOfWeek = Cal_GetParamFirstDayOfWeek ();
|
||||||
|
|
||||||
/***** Store icon first day of week database *****/
|
/***** Store icon first day of week database *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET FirstDayOfWeek=%u"
|
DB_BuildQuery ("UPDATE usr_data SET FirstDayOfWeek=%u"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
Gbl.Prefs.FirstDayOfWeek,
|
Gbl.Prefs.FirstDayOfWeek,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about first day of week");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about first day of week");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set preferences from current IP *****/
|
/***** Set preferences from current IP *****/
|
||||||
|
|
|
@ -1869,13 +1869,10 @@ void Ctr_ContEditAfterChgCtrInConfig (void)
|
||||||
|
|
||||||
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
|
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update institution in table of centres *****/
|
/***** Update institution in table of centres *****/
|
||||||
if (asprintf (&Query,"UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
|
DB_BuildQuery ("UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
|
||||||
InsCod,CtrCod) < 0)
|
InsCod,CtrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the institution of a centre");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the institution of a centre");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1936,12 +1933,9 @@ void Ctr_ChangeCtrPlcInConfig (void)
|
||||||
|
|
||||||
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod)
|
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
|
||||||
|
NewPlcCod,CtrCod);
|
||||||
if (asprintf (&Query,"UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
|
DB_QueryUPDATE_new ("can not update the place of a centre");
|
||||||
NewPlcCod,CtrCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update the place of a centre");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2078,13 +2072,10 @@ static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Nam
|
||||||
|
|
||||||
static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *NewCtrName)
|
static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *NewCtrName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update centre changing old name by new name */
|
/***** Update centre changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
|
DB_BuildQuery ("UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
|
||||||
FieldName,NewCtrName,CtrCod) < 0)
|
FieldName,NewCtrName,CtrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a centre");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a centre");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2167,13 +2158,10 @@ void Ctr_ChangeCtrWWWInConfig (void)
|
||||||
static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
||||||
const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update database changing old WWW by new WWW *****/
|
/***** Update database changing old WWW by new WWW *****/
|
||||||
if (asprintf (&Query,"UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
|
DB_BuildQuery ("UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
|
||||||
NewWWW,CtrCod) < 0)
|
NewWWW,CtrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of a centre");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of a centre");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2183,7 +2171,6 @@ static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
||||||
void Ctr_ChangeCtrStatus (void)
|
void Ctr_ChangeCtrStatus (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_status_of_the_centre_X_has_changed;
|
extern const char *Txt_The_status_of_the_centre_X_has_changed;
|
||||||
char *Query;
|
|
||||||
Ctr_Status_t Status;
|
Ctr_Status_t Status;
|
||||||
Ctr_StatusTxt_t StatusTxt;
|
Ctr_StatusTxt_t StatusTxt;
|
||||||
|
|
||||||
|
@ -2205,10 +2192,9 @@ void Ctr_ChangeCtrStatus (void)
|
||||||
Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr);
|
Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr);
|
||||||
|
|
||||||
/***** Update status in table of centres *****/
|
/***** Update status in table of centres *****/
|
||||||
if (asprintf (&Query,"UPDATE centres SET Status=%u WHERE CtrCod=%ld",
|
DB_BuildQuery ("UPDATE centres SET Status=%u WHERE CtrCod=%ld",
|
||||||
(unsigned) Status,Gbl.Ctrs.EditingCtr.CtrCod) < 0)
|
(unsigned) Status,Gbl.Ctrs.EditingCtr.CtrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the status of a centre");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the status of a centre");
|
|
||||||
Gbl.Ctrs.EditingCtr.Status = Status;
|
Gbl.Ctrs.EditingCtr.Status = Status;
|
||||||
|
|
||||||
/***** Write message to show the change made
|
/***** Write message to show the change made
|
||||||
|
@ -2481,7 +2467,6 @@ void Ctr_ReceivePhoto (void)
|
||||||
|
|
||||||
void Ctr_ChangeCtrPhotoAttribution (void)
|
void Ctr_ChangeCtrPhotoAttribution (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
char NewPhotoAttribution[Img_MAX_BYTES_ATTRIBUTION + 1];
|
char NewPhotoAttribution[Img_MAX_BYTES_ATTRIBUTION + 1];
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
|
@ -2489,11 +2474,10 @@ void Ctr_ChangeCtrPhotoAttribution (void)
|
||||||
Par_GetParToText ("Attribution",NewPhotoAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
Par_GetParToText ("Attribution",NewPhotoAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
||||||
|
|
||||||
/***** Update the table changing old attribution by new attribution *****/
|
/***** Update the table changing old attribution by new attribution *****/
|
||||||
if (asprintf (&Query,"UPDATE centres SET PhotoAttribution='%s'"
|
DB_BuildQuery ("UPDATE centres SET PhotoAttribution='%s'"
|
||||||
" WHERE CtrCod=%ld",
|
" WHERE CtrCod=%ld",
|
||||||
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod) < 0)
|
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the photo attribution of the current centre");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the photo attribution of the current centre");
|
|
||||||
|
|
||||||
/***** Show the centre information again *****/
|
/***** Show the centre information again *****/
|
||||||
Ctr_ShowConfiguration ();
|
Ctr_ShowConfiguration ();
|
||||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.8.12 (2018-10-27)"
|
#define Log_PLATFORM_VERSION "SWAD 18.8.13 (2018-10-27)"
|
||||||
#define CSS_FILE "swad18.4.css"
|
#define CSS_FILE "swad18.4.css"
|
||||||
#define JS_FILE "swad17.17.1.js"
|
#define JS_FILE "swad17.17.1.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.8.13: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236661 lines)
|
||||||
Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)
|
Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)
|
||||||
Version 18.8.11: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236921 lines)
|
Version 18.8.11: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236921 lines)
|
||||||
Version 18.8.10: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236975 lines)
|
Version 18.8.10: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236975 lines)
|
||||||
|
|
|
@ -1861,13 +1861,10 @@ static bool Cty_CheckIfCountryNameExists (Txt_Language_t Language,const char *Na
|
||||||
|
|
||||||
static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *NewCtyName)
|
static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *NewCtyName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update country changing old name by new name */
|
/***** Update country changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
|
DB_BuildQuery ("UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
|
||||||
FieldName,NewCtyName,CtyCod) < 0)
|
FieldName,NewCtyName,CtyCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a country");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a country");
|
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
Cty_FlushCacheCountryName ();
|
Cty_FlushCacheCountryName ();
|
||||||
|
@ -1881,7 +1878,6 @@ void Cty_ChangeCtyWWW (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_new_web_address_is_X;
|
extern const char *Txt_The_new_web_address_is_X;
|
||||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||||
char *Query;
|
|
||||||
struct Country *Cty;
|
struct Country *Cty;
|
||||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
Txt_Language_t Language;
|
Txt_Language_t Language;
|
||||||
|
@ -1901,11 +1897,10 @@ void Cty_ChangeCtyWWW (void)
|
||||||
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
|
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
|
||||||
|
|
||||||
/***** Update the table changing old WWW by new WWW *****/
|
/***** Update the table changing old WWW by new WWW *****/
|
||||||
if (asprintf (&Query,"UPDATE countries SET WWW_%s='%s'"
|
DB_BuildQuery ("UPDATE countries SET WWW_%s='%s'"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
Txt_STR_LANG_ID[Language],NewWWW,Cty->CtyCod) < 0)
|
Txt_STR_LANG_ID[Language],NewWWW,Cty->CtyCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of a country");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of a country");
|
|
||||||
Str_Copy (Cty->WWW[Language],NewWWW,
|
Str_Copy (Cty->WWW[Language],NewWWW,
|
||||||
Cns_MAX_BYTES_WWW);
|
Cns_MAX_BYTES_WWW);
|
||||||
|
|
||||||
|
@ -1925,7 +1920,6 @@ void Cty_ChangeCtyWWW (void)
|
||||||
|
|
||||||
void Cty_ChangeCtyMapAttribution (void)
|
void Cty_ChangeCtyMapAttribution (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
char NewMapAttribution[Img_MAX_BYTES_ATTRIBUTION + 1];
|
char NewMapAttribution[Img_MAX_BYTES_ATTRIBUTION + 1];
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
|
@ -1933,11 +1927,10 @@ void Cty_ChangeCtyMapAttribution (void)
|
||||||
Par_GetParToText ("Attribution",NewMapAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
Par_GetParToText ("Attribution",NewMapAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
||||||
|
|
||||||
/***** Update the table changing old attribution by new attribution *****/
|
/***** Update the table changing old attribution by new attribution *****/
|
||||||
if (asprintf (&Query,"UPDATE countries SET MapAttribution='%s'"
|
DB_BuildQuery ("UPDATE countries SET MapAttribution='%s'"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
NewMapAttribution,Gbl.CurrentCty.Cty.CtyCod) < 0)
|
NewMapAttribution,Gbl.CurrentCty.Cty.CtyCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the map attribution of a country");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the map attribution of a country");
|
|
||||||
|
|
||||||
/***** Show the country information again *****/
|
/***** Show the country information again *****/
|
||||||
Cty_ShowConfiguration ();
|
Cty_ShowConfiguration ();
|
||||||
|
|
|
@ -2179,11 +2179,10 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
||||||
|
|
||||||
/***** Remove exam announcements in the course *****/
|
/***** Remove exam announcements in the course *****/
|
||||||
/* Mark all exam announcements in the course as deleted */
|
/* Mark all exam announcements in the course as deleted */
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||||
" WHERE CrsCod=%ld",
|
" WHERE CrsCod=%ld",
|
||||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod) < 0)
|
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not remove exam announcements of a course");
|
||||||
DB_QueryUPDATE_free (Query,"can not remove exam announcements of a course");
|
|
||||||
|
|
||||||
/***** Remove course cards of the course *****/
|
/***** Remove course cards of the course *****/
|
||||||
/* Remove content of course cards */
|
/* Remove content of course cards */
|
||||||
|
@ -2447,13 +2446,10 @@ void Crs_ContEditAfterChgCrsInConfig (void)
|
||||||
|
|
||||||
static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod)
|
static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update degree in table of courses *****/
|
/***** Update degree in table of courses *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
|
||||||
DegCod,CrsCod) < 0)
|
DegCod,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not move course to another degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not move course to another degree");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2596,13 +2592,10 @@ void Crs_ChangeCrsYear (void)
|
||||||
|
|
||||||
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update year/semester in table of courses *****/
|
/***** Update year/semester in table of courses *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET Year=%u WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET Year=%u WHERE CrsCod=%ld",
|
||||||
NewYear,Crs->CrsCod) < 0)
|
NewYear,Crs->CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the year of a course");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the year of a course");
|
|
||||||
|
|
||||||
/***** Copy course year/semester *****/
|
/***** Copy course year/semester *****/
|
||||||
Crs->Year = NewYear;
|
Crs->Year = NewYear;
|
||||||
|
@ -2777,13 +2770,10 @@ static bool Crs_CheckIfCrsNameExistsInYearOfDeg (const char *FieldName,const cha
|
||||||
|
|
||||||
static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *NewCrsName)
|
static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *NewCrsName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update course changing old name by new name *****/
|
/***** Update course changing old name by new name *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
|
||||||
FieldName,NewCrsName,CrsCod) < 0)
|
FieldName,NewCrsName,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a course");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a course");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2793,7 +2783,6 @@ static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *N
|
||||||
void Crs_ChangeCrsStatus (void)
|
void Crs_ChangeCrsStatus (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_status_of_the_course_X_has_changed;
|
extern const char *Txt_The_status_of_the_course_X_has_changed;
|
||||||
char *Query;
|
|
||||||
Crs_Status_t Status;
|
Crs_Status_t Status;
|
||||||
Crs_StatusTxt_t StatusTxt;
|
Crs_StatusTxt_t StatusTxt;
|
||||||
|
|
||||||
|
@ -2816,10 +2805,9 @@ void Crs_ChangeCrsStatus (void)
|
||||||
Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs);
|
Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs);
|
||||||
|
|
||||||
/***** Update status in table of courses *****/
|
/***** Update status in table of courses *****/
|
||||||
if (asprintf (&Query,"UPDATE courses SET Status=%u WHERE CrsCod=%ld",
|
DB_BuildQuery ("UPDATE courses SET Status=%u WHERE CrsCod=%ld",
|
||||||
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod) < 0)
|
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the status of a course");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the status of a course");
|
|
||||||
Gbl.Degs.EditingCrs.Status = Status;
|
Gbl.Degs.EditingCrs.Status = Status;
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
|
@ -3369,17 +3357,14 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
|
||||||
|
|
||||||
void Crs_UpdateCrsLast (void)
|
void Crs_UpdateCrsLast (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||||
Gbl.Usrs.Me.Role.Logged >= Rol_STD)
|
Gbl.Usrs.Me.Role.Logged >= Rol_STD)
|
||||||
{
|
{
|
||||||
/***** Update my last access to current course *****/
|
/***** Update my last access to current course *****/
|
||||||
if (asprintf (&Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
|
DB_BuildQuery ("REPLACE INTO crs_last (CrsCod,LastTime)"
|
||||||
" VALUES (%ld,NOW())",
|
" VALUES (%ld,NOW())",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update last access to current course");
|
||||||
DB_QueryUPDATE_free (Query,"can not update last access to current course");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3269,17 +3269,6 @@ void DB_QueryREPLACE_new (const char *MsgError)
|
||||||
DB_ExitOnMySQLError (MsgError);
|
DB_ExitOnMySQLError (MsgError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DB_QueryREPLACE_free (const char *Query,const char *MsgError)
|
|
||||||
{
|
|
||||||
int Result;
|
|
||||||
|
|
||||||
/***** Query database *****/
|
|
||||||
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
|
|
||||||
free ((void *) Query);
|
|
||||||
if (Result)
|
|
||||||
DB_ExitOnMySQLError (MsgError);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DB_QueryREPLACE (const char *Query,const char *MsgError)
|
void DB_QueryREPLACE (const char *Query,const char *MsgError)
|
||||||
{
|
{
|
||||||
/***** Query database *****/
|
/***** Query database *****/
|
||||||
|
|
|
@ -52,7 +52,6 @@ long DB_QueryINSERTandReturnCode_new (const char *MsgError);
|
||||||
long DB_QueryINSERTandReturnCode (const char *Query,const char *MsgError);
|
long DB_QueryINSERTandReturnCode (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_QueryREPLACE_new (const char *MsgError);
|
void DB_QueryREPLACE_new (const char *MsgError);
|
||||||
void DB_QueryREPLACE_free (const char *Query,const char *MsgError);
|
|
||||||
void DB_QueryREPLACE (const char *Query,const char *MsgError);
|
void DB_QueryREPLACE (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_QueryUPDATE_new (const char *MsgError);
|
void DB_QueryUPDATE_new (const char *MsgError);
|
||||||
|
|
13
swad_date.c
13
swad_date.c
|
@ -179,20 +179,17 @@ void Dat_PutScriptDateFormat (Dat_Format_t Format)
|
||||||
|
|
||||||
void Dat_ChangeDateFormat (void)
|
void Dat_ChangeDateFormat (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get param with date format *****/
|
/***** Get param with date format *****/
|
||||||
Gbl.Prefs.DateFormat = Dat_GetParamDateFormat ();
|
Gbl.Prefs.DateFormat = Dat_GetParamDateFormat ();
|
||||||
|
|
||||||
/***** Store date format in database *****/
|
/***** Store date format in database *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if (asprintf (&Query,"UPDATE usr_data SET DateFormat=%u"
|
DB_BuildQuery ("UPDATE usr_data SET DateFormat=%u"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
(unsigned) Gbl.Prefs.DateFormat,
|
(unsigned) Gbl.Prefs.DateFormat,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update your preference about date format");
|
||||||
DB_QueryUPDATE_free (Query,"can not update your preference about date format");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set preferences from current IP *****/
|
/***** Set preferences from current IP *****/
|
||||||
|
|
|
@ -2030,13 +2030,10 @@ static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Nam
|
||||||
|
|
||||||
static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *NewDegName)
|
static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *NewDegName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update degree changing old name by new name *****/
|
/***** Update degree changing old name by new name *****/
|
||||||
if (asprintf (&Query,"UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
|
DB_BuildQuery ("UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
|
||||||
FieldName,NewDegName,DegCod) < 0)
|
FieldName,NewDegName,DegCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a degree");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2112,13 +2109,10 @@ void Deg_ContEditAfterChgDegInConfig (void)
|
||||||
|
|
||||||
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update centre in table of degrees *****/
|
/***** Update centre in table of degrees *****/
|
||||||
if (asprintf (&Query,"UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
DB_BuildQuery ("UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
||||||
CtrCod,DegCod) < 0)
|
CtrCod,DegCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the centre of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the centre of a degree");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2201,13 +2195,10 @@ void Deg_ChangeDegWWWInConfig (void)
|
||||||
|
|
||||||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update database changing old WWW by new WWW *****/
|
/***** Update database changing old WWW by new WWW *****/
|
||||||
if (asprintf (&Query,"UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
|
DB_BuildQuery ("UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
|
||||||
NewWWW,DegCod) < 0)
|
NewWWW,DegCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of a degree");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2217,7 +2208,6 @@ static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW
|
||||||
void Deg_ChangeDegStatus (void)
|
void Deg_ChangeDegStatus (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_status_of_the_degree_X_has_changed;
|
extern const char *Txt_The_status_of_the_degree_X_has_changed;
|
||||||
char *Query;
|
|
||||||
Deg_Status_t Status;
|
Deg_Status_t Status;
|
||||||
Deg_StatusTxt_t StatusTxt;
|
Deg_StatusTxt_t StatusTxt;
|
||||||
|
|
||||||
|
@ -2240,10 +2230,9 @@ void Deg_ChangeDegStatus (void)
|
||||||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||||
|
|
||||||
/***** Update status in table of degrees *****/
|
/***** Update status in table of degrees *****/
|
||||||
if (asprintf (&Query,"UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
DB_BuildQuery ("UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
||||||
(unsigned) Status,Gbl.Degs.EditingDeg.DegCod) < 0)
|
(unsigned) Status,Gbl.Degs.EditingDeg.DegCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the status of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the status of a degree");
|
|
||||||
|
|
||||||
Gbl.Degs.EditingDeg.Status = Status;
|
Gbl.Degs.EditingDeg.Status = Status;
|
||||||
|
|
||||||
|
|
|
@ -915,7 +915,6 @@ void DT_RenameDegreeType (void)
|
||||||
extern const char *Txt_The_type_of_degree_X_has_been_renamed_as_Y;
|
extern const char *Txt_The_type_of_degree_X_has_been_renamed_as_Y;
|
||||||
extern const char *Txt_The_name_of_the_type_of_degree_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_type_of_degree_X_has_not_changed;
|
||||||
struct DegreeType *DegTyp;
|
struct DegreeType *DegTyp;
|
||||||
char *Query;
|
|
||||||
char NewNameDegTyp[Deg_MAX_BYTES_DEGREE_TYPE_NAME + 1];
|
char NewNameDegTyp[Deg_MAX_BYTES_DEGREE_TYPE_NAME + 1];
|
||||||
|
|
||||||
DegTyp = &Gbl.Degs.EditingDegTyp;
|
DegTyp = &Gbl.Degs.EditingDegTyp;
|
||||||
|
@ -955,11 +954,10 @@ void DT_RenameDegreeType (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/* Update the table changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE deg_types SET DegTypName='%s'"
|
DB_BuildQuery ("UPDATE deg_types SET DegTypName='%s'"
|
||||||
" WHERE DegTypCod=%ld",
|
" WHERE DegTypCod=%ld",
|
||||||
NewNameDegTyp,DegTyp->DegTypCod) < 0)
|
NewNameDegTyp,DegTyp->DegTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the type of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the type of a degree");
|
|
||||||
|
|
||||||
/* Write message to show the change made */
|
/* Write message to show the change made */
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1004,7 +1002,6 @@ void DT_ChangeDegreeType (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
|
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
|
||||||
long NewDegTypCod;
|
long NewDegTypCod;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get degree code */
|
/* Get degree code */
|
||||||
|
@ -1017,10 +1014,9 @@ void DT_ChangeDegreeType (void)
|
||||||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||||
|
|
||||||
/***** Update the table of degrees changing old type by new type *****/
|
/***** Update the table of degrees changing old type by new type *****/
|
||||||
if (asprintf (&Query,"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
DB_BuildQuery ("UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||||
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod) < 0)
|
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the type of a degree");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the type of a degree");
|
|
||||||
|
|
||||||
/***** Write message to show the change made
|
/***** Write message to show the change made
|
||||||
and put button to go to degree changed *****/
|
and put button to go to degree changed *****/
|
||||||
|
|
|
@ -645,7 +645,6 @@ void Dpt_ChangeDepartIns (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_institution_of_the_department_has_changed;
|
extern const char *Txt_The_institution_of_the_department_has_changed;
|
||||||
struct Department *Dpt;
|
struct Department *Dpt;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
Dpt = &Gbl.Dpts.EditingDpt;
|
Dpt = &Gbl.Dpts.EditingDpt;
|
||||||
|
|
||||||
|
@ -657,10 +656,9 @@ void Dpt_ChangeDepartIns (void)
|
||||||
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1);
|
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1);
|
||||||
|
|
||||||
/***** Update institution in table of departments *****/
|
/***** Update institution in table of departments *****/
|
||||||
if (asprintf (&Query,"UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
|
DB_BuildQuery ("UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
|
||||||
Dpt->InsCod,Dpt->DptCod) < 0)
|
Dpt->InsCod,Dpt->DptCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the institution of a department");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the institution of a department");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed);
|
||||||
|
@ -799,13 +797,10 @@ static bool Dpt_CheckIfDepartmentNameExists (const char *FieldName,const char *N
|
||||||
|
|
||||||
static void Dpt_UpdateDegNameDB (long DptCod,const char *FieldName,const char *NewDptName)
|
static void Dpt_UpdateDegNameDB (long DptCod,const char *FieldName,const char *NewDptName)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update department changing old name by new name *****/
|
/***** Update department changing old name by new name *****/
|
||||||
if (asprintf (&Query,"UPDATE departments SET %s='%s' WHERE DptCod=%ld",
|
DB_BuildQuery ("UPDATE departments SET %s='%s' WHERE DptCod=%ld",
|
||||||
FieldName,NewDptName,DptCod) < 0)
|
FieldName,NewDptName,DptCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a department");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a department");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -817,7 +812,6 @@ void Dpt_ChangeDptWWW (void)
|
||||||
extern const char *Txt_The_new_web_address_is_X;
|
extern const char *Txt_The_new_web_address_is_X;
|
||||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||||
struct Department *Dpt;
|
struct Department *Dpt;
|
||||||
char *Query;
|
|
||||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
|
|
||||||
Dpt = &Gbl.Dpts.EditingDpt;
|
Dpt = &Gbl.Dpts.EditingDpt;
|
||||||
|
@ -833,10 +827,9 @@ void Dpt_ChangeDptWWW (void)
|
||||||
if (NewWWW[0])
|
if (NewWWW[0])
|
||||||
{
|
{
|
||||||
/* Update the table changing old WWW by new WWW */
|
/* Update the table changing old WWW by new WWW */
|
||||||
if (asprintf (&Query,"UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
|
DB_BuildQuery ("UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
|
||||||
NewWWW,Dpt->DptCod) < 0)
|
NewWWW,Dpt->DptCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the web of a department");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the web of a department");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
117
swad_enrolment.c
117
swad_enrolment.c
|
@ -209,8 +209,6 @@ void Enr_PutLinkToRequestSignUp (void)
|
||||||
|
|
||||||
void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Check if user's role is allowed *****/
|
/***** Check if user's role is allowed *****/
|
||||||
switch (NewRole)
|
switch (NewRole)
|
||||||
{
|
{
|
||||||
|
@ -223,11 +221,10 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Update the role of a user in a course *****/
|
/***** Update the role of a user in a course *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_usr SET Role=%u"
|
DB_BuildQuery ("UPDATE crs_usr SET Role=%u"
|
||||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||||
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod) < 0)
|
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not modify user's role in course");
|
||||||
DB_QueryUPDATE_free (Query,"can not modify user's role in course");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Usr_FlushCachesUsr ();
|
Usr_FlushCachesUsr ();
|
||||||
|
@ -519,7 +516,6 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
|
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
|
||||||
char BirthdayStrDB[Usr_BIRTHDAY_STR_DB_LENGTH + 1];
|
char BirthdayStrDB[Usr_BIRTHDAY_STR_DB_LENGTH + 1];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Check if user's code is initialized *****/
|
/***** Check if user's code is initialized *****/
|
||||||
if (UsrDat->UsrCod <= 0)
|
if (UsrDat->UsrCod <= 0)
|
||||||
|
@ -530,28 +526,27 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
||||||
|
|
||||||
/***** Update user's common data *****/
|
/***** Update user's common data *****/
|
||||||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
||||||
if (asprintf (&Query,"UPDATE usr_data"
|
DB_BuildQuery ("UPDATE usr_data"
|
||||||
" SET Password='%s',"
|
" SET Password='%s',"
|
||||||
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
||||||
"CtyCod=%ld,"
|
"CtyCod=%ld,"
|
||||||
"LocalAddress='%s',LocalPhone='%s',"
|
"LocalAddress='%s',LocalPhone='%s',"
|
||||||
"FamilyAddress='%s',FamilyPhone='%s',"
|
"FamilyAddress='%s',FamilyPhone='%s',"
|
||||||
"OriginPlace='%s',Birthday=%s,"
|
"OriginPlace='%s',Birthday=%s,"
|
||||||
"Comments='%s'"
|
"Comments='%s'"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrDat->Password,
|
UsrDat->Password,
|
||||||
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
|
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
|
||||||
Usr_StringsSexDB[UsrDat->Sex],
|
Usr_StringsSexDB[UsrDat->Sex],
|
||||||
UsrDat->CtyCod,
|
UsrDat->CtyCod,
|
||||||
UsrDat->LocalAddress,UsrDat->LocalPhone,
|
UsrDat->LocalAddress,UsrDat->LocalPhone,
|
||||||
UsrDat->FamilyAddress,UsrDat->FamilyPhone,
|
UsrDat->FamilyAddress,UsrDat->FamilyPhone,
|
||||||
UsrDat->OriginPlace,
|
UsrDat->OriginPlace,
|
||||||
BirthdayStrDB,
|
BirthdayStrDB,
|
||||||
UsrDat->Comments ? UsrDat->Comments :
|
UsrDat->Comments ? UsrDat->Comments :
|
||||||
"",
|
"",
|
||||||
UsrDat->UsrCod) < 0)
|
UsrDat->UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update user's data");
|
||||||
DB_QueryUPDATE_free (Query,"can not update user's data");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -574,18 +569,15 @@ void Enr_FilterUsrDat (struct UsrData *UsrDat)
|
||||||
|
|
||||||
void Enr_UpdateInstitutionCentreDepartment (void)
|
void Enr_UpdateInstitutionCentreDepartment (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("UPDATE usr_data"
|
||||||
|
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
|
||||||
if (asprintf (&Query,"UPDATE usr_data"
|
" WHERE UsrCod=%ld",
|
||||||
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
|
Gbl.Usrs.Me.UsrDat.InsCtyCod,
|
||||||
" WHERE UsrCod=%ld",
|
Gbl.Usrs.Me.UsrDat.InsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.InsCtyCod,
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.InsCod,
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod,
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.CtrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.DptCod,
|
DB_QueryUPDATE_new ("can not update institution, centre and department");
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update institution, centre and department");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3031,27 +3023,23 @@ static void Enr_RemoveEnrolmentRequest (long CrsCod,long UsrCod)
|
||||||
|
|
||||||
static void Enr_RemoveExpiredEnrolmentRequests (void)
|
static void Enr_RemoveExpiredEnrolmentRequests (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Mark possible notifications as removed
|
/***** Mark possible notifications as removed
|
||||||
Important: do this before removing the request *****/
|
Important: do this before removing the request *****/
|
||||||
if (asprintf (&Query,"UPDATE notif,crs_usr_requests"
|
DB_BuildQuery ("UPDATE notif,crs_usr_requests"
|
||||||
" SET notif.Status=(notif.Status | %u)"
|
" SET notif.Status=(notif.Status | %u)"
|
||||||
" WHERE notif.NotifyEvent=%u"
|
" WHERE notif.NotifyEvent=%u"
|
||||||
" AND notif.Cod=crs_usr_requests.ReqCod"
|
" AND notif.Cod=crs_usr_requests.ReqCod"
|
||||||
" AND crs_usr_requests.RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" AND crs_usr_requests.RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||||
(unsigned) Ntf_EVENT_ENROLMENT_REQUEST,
|
(unsigned) Ntf_EVENT_ENROLMENT_REQUEST,
|
||||||
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS) < 0)
|
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||||
DB_QueryUPDATE_free (Query,"can not set notification(s) as removed");
|
|
||||||
|
|
||||||
/***** Remove expired requests for enrolment *****/
|
/***** Remove expired requests for enrolment *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_usr_requests"
|
DB_BuildQuery ("DELETE FROM crs_usr_requests"
|
||||||
" WHERE RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" WHERE RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS) < 0)
|
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove expired requests for enrolment");
|
||||||
DB_QueryDELETE_free (Query,"can not remove expired requests for enrolment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4102,14 +4090,11 @@ void Enr_ModifyUsr2 (void)
|
||||||
|
|
||||||
void Enr_AcceptUsrInCrs (long UsrCod)
|
void Enr_AcceptUsrInCrs (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Set enrolment of a user to "accepted" in the current course *****/
|
/***** Set enrolment of a user to "accepted" in the current course *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_usr SET Accepted='Y'"
|
DB_BuildQuery ("UPDATE crs_usr SET Accepted='Y'"
|
||||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod) < 0)
|
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not confirm user's enrolment");
|
||||||
DB_QueryUPDATE_free (Query,"can not confirm user's enrolment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
102
swad_exam.c
102
swad_exam.c
|
@ -318,14 +318,11 @@ void Exa_ReceiveExamAnnouncement2 (void)
|
||||||
|
|
||||||
static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,unsigned NumUsrsToBeNotifiedByEMail)
|
static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
/***** Update number of users notified *****/
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements SET NumNotif=NumNotif+%u"
|
DB_BuildQuery ("UPDATE exam_announcements SET NumNotif=NumNotif+%u"
|
||||||
" WHERE ExaCod=%ld",
|
" WHERE ExaCod=%ld",
|
||||||
NumUsrsToBeNotifiedByEMail,ExaCod) < 0)
|
NumUsrsToBeNotifiedByEMail,ExaCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the number of notifications of an exam announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the number of notifications of an exam announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -387,7 +384,6 @@ void Exa_ReqRemoveExamAnnouncement (void)
|
||||||
|
|
||||||
void Exa_RemoveExamAnnouncement1 (void)
|
void Exa_RemoveExamAnnouncement1 (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long ExaCod;
|
long ExaCod;
|
||||||
|
|
||||||
/***** Get the code of the exam announcement *****/
|
/***** Get the code of the exam announcement *****/
|
||||||
|
@ -395,12 +391,11 @@ void Exa_RemoveExamAnnouncement1 (void)
|
||||||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||||
|
|
||||||
/***** Mark the exam announcement as deleted in the database *****/
|
/***** Mark the exam announcement as deleted in the database *****/
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,
|
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,
|
||||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not remove exam announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not remove exam announcement");
|
|
||||||
|
|
||||||
/***** Mark possible notifications as removed *****/
|
/***** Mark possible notifications as removed *****/
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
|
||||||
|
@ -431,7 +426,6 @@ void Exa_RemoveExamAnnouncement2 (void)
|
||||||
|
|
||||||
void Exa_HideExamAnnouncement1 (void)
|
void Exa_HideExamAnnouncement1 (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long ExaCod;
|
long ExaCod;
|
||||||
|
|
||||||
/***** Get the code of the exam announcement *****/
|
/***** Get the code of the exam announcement *****/
|
||||||
|
@ -439,12 +433,11 @@ void Exa_HideExamAnnouncement1 (void)
|
||||||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||||
|
|
||||||
/***** Mark the exam announcement as hidden in the database *****/
|
/***** Mark the exam announcement as hidden in the database *****/
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||||
(unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT,
|
(unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT,
|
||||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not hide exam announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not hide exam announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exa_HideExamAnnouncement2 (void)
|
void Exa_HideExamAnnouncement2 (void)
|
||||||
|
@ -466,7 +459,6 @@ void Exa_HideExamAnnouncement2 (void)
|
||||||
|
|
||||||
void Exa_UnhideExamAnnouncement1 (void)
|
void Exa_UnhideExamAnnouncement1 (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long ExaCod;
|
long ExaCod;
|
||||||
|
|
||||||
/***** Get the code of the exam announcement *****/
|
/***** Get the code of the exam announcement *****/
|
||||||
|
@ -474,12 +466,11 @@ void Exa_UnhideExamAnnouncement1 (void)
|
||||||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||||
|
|
||||||
/***** Mark the exam announcement as visible in the database *****/
|
/***** Mark the exam announcement as visible in the database *****/
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements SET Status=%u"
|
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
|
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
|
||||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not unhide exam announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not unhide exam announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exa_UnhideExamAnnouncement2 (void)
|
void Exa_UnhideExamAnnouncement2 (void)
|
||||||
|
@ -780,36 +771,33 @@ static long Exa_AddExamAnnouncementToDB (void)
|
||||||
|
|
||||||
static void Exa_ModifyExamAnnouncementInDB (void)
|
static void Exa_ModifyExamAnnouncementInDB (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Modify exam announcement *****/
|
/***** Modify exam announcement *****/
|
||||||
if (asprintf (&Query,"UPDATE exam_announcements"
|
DB_BuildQuery ("UPDATE exam_announcements"
|
||||||
" SET CrsFullName='%s',Year=%u,ExamSession='%s',"
|
" SET CrsFullName='%s',Year=%u,ExamSession='%s',"
|
||||||
"ExamDate='%04u-%02u-%02u %02u:%02u:00',"
|
"ExamDate='%04u-%02u-%02u %02u:%02u:00',"
|
||||||
"Duration='%02u:%02u:00',"
|
"Duration='%02u:%02u:00',"
|
||||||
"Place='%s',ExamMode='%s',Structure='%s',"
|
"Place='%s',ExamMode='%s',Structure='%s',"
|
||||||
"DocRequired='%s',MatRequired='%s',MatAllowed='%s',OtherInfo='%s'"
|
"DocRequired='%s',MatRequired='%s',MatAllowed='%s',OtherInfo='%s'"
|
||||||
" WHERE ExaCod=%ld",
|
" WHERE ExaCod=%ld",
|
||||||
Gbl.ExamAnns.ExaDat.CrsFullName,
|
Gbl.ExamAnns.ExaDat.CrsFullName,
|
||||||
Gbl.ExamAnns.ExaDat.Year,
|
Gbl.ExamAnns.ExaDat.Year,
|
||||||
Gbl.ExamAnns.ExaDat.Session,
|
Gbl.ExamAnns.ExaDat.Session,
|
||||||
Gbl.ExamAnns.ExaDat.ExamDate.Year,
|
Gbl.ExamAnns.ExaDat.ExamDate.Year,
|
||||||
Gbl.ExamAnns.ExaDat.ExamDate.Month,
|
Gbl.ExamAnns.ExaDat.ExamDate.Month,
|
||||||
Gbl.ExamAnns.ExaDat.ExamDate.Day,
|
Gbl.ExamAnns.ExaDat.ExamDate.Day,
|
||||||
Gbl.ExamAnns.ExaDat.StartTime.Hour,
|
Gbl.ExamAnns.ExaDat.StartTime.Hour,
|
||||||
Gbl.ExamAnns.ExaDat.StartTime.Minute,
|
Gbl.ExamAnns.ExaDat.StartTime.Minute,
|
||||||
Gbl.ExamAnns.ExaDat.Duration.Hour,
|
Gbl.ExamAnns.ExaDat.Duration.Hour,
|
||||||
Gbl.ExamAnns.ExaDat.Duration.Minute,
|
Gbl.ExamAnns.ExaDat.Duration.Minute,
|
||||||
Gbl.ExamAnns.ExaDat.Place,
|
Gbl.ExamAnns.ExaDat.Place,
|
||||||
Gbl.ExamAnns.ExaDat.Mode,
|
Gbl.ExamAnns.ExaDat.Mode,
|
||||||
Gbl.ExamAnns.ExaDat.Structure,
|
Gbl.ExamAnns.ExaDat.Structure,
|
||||||
Gbl.ExamAnns.ExaDat.DocRequired,
|
Gbl.ExamAnns.ExaDat.DocRequired,
|
||||||
Gbl.ExamAnns.ExaDat.MatRequired,
|
Gbl.ExamAnns.ExaDat.MatRequired,
|
||||||
Gbl.ExamAnns.ExaDat.MatAllowed,
|
Gbl.ExamAnns.ExaDat.MatAllowed,
|
||||||
Gbl.ExamAnns.ExaDat.OtherInfo,
|
Gbl.ExamAnns.ExaDat.OtherInfo,
|
||||||
Gbl.ExamAnns.ExaDat.ExaCod) < 0)
|
Gbl.ExamAnns.ExaDat.ExaCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update an exam announcement");
|
||||||
DB_QueryUPDATE_free (Query,"can not update an exam announcement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -4255,15 +4255,12 @@ static void Brw_UpdateLastAccess (void)
|
||||||
|
|
||||||
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the group of my last access to a common zone *****/
|
/***** Update the group of my last access to a common zone *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_usr SET %s=%ld"
|
DB_BuildQuery ("UPDATE crs_usr SET %s=%ld"
|
||||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||||
FieldNameDB,GrpCod,
|
FieldNameDB,GrpCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the group of the last access to a file browser");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the group of the last access to a file browser");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -7895,19 +7892,17 @@ static void Brw_UpdatePathInClipboard (void)
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForClipboard ();
|
long Cod = Brw_GetCodForClipboard ();
|
||||||
long WorksUsrCod = Brw_GetWorksUsrCodForClipboard ();
|
long WorksUsrCod = Brw_GetWorksUsrCodForClipboard ();
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update path in my clipboard *****/
|
/***** Update path in my clipboard *****/
|
||||||
if (asprintf (&Query,"UPDATE clipboard SET FileBrowser=%u,"
|
DB_BuildQuery ("UPDATE clipboard SET FileBrowser=%u,"
|
||||||
"Cod=%ld,WorksUsrCod=%ld,"
|
"Cod=%ld,WorksUsrCod=%ld,"
|
||||||
"FileType=%u,Path='%s'"
|
"FileType=%u,Path='%s'"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
(unsigned) Gbl.FileBrowser.Type,
|
(unsigned) Gbl.FileBrowser.Type,
|
||||||
Cod,WorksUsrCod,
|
Cod,WorksUsrCod,
|
||||||
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree,
|
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update source of copy in clipboard");
|
||||||
DB_QueryUPDATE_free (Query,"can not update source of copy in clipboard");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -8048,43 +8043,33 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForExpandedFolders ();
|
long Cod = Brw_GetCodForExpandedFolders ();
|
||||||
long WorksUsrCod = Brw_GetWorksUsrCodForExpandedFolders ();
|
long WorksUsrCod = Brw_GetWorksUsrCodForExpandedFolders ();
|
||||||
char *Query;
|
|
||||||
Brw_FileBrowser_t FileBrowserForExpandedFolders = Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type];
|
Brw_FileBrowser_t FileBrowserForExpandedFolders = Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type];
|
||||||
|
|
||||||
/***** Update click time in table of expanded folders *****/
|
/***** Update click time in table of expanded folders *****/
|
||||||
if (Cod > 0)
|
if (Cod > 0)
|
||||||
{
|
{
|
||||||
if (WorksUsrCod > 0)
|
if (WorksUsrCod > 0)
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
" AND Cod=%ld AND WorksUsrCod=%ld",
|
||||||
" AND Cod=%ld AND WorksUsrCod=%ld",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) FileBrowserForExpandedFolders,
|
||||||
(unsigned) FileBrowserForExpandedFolders,
|
Cod,
|
||||||
Cod,
|
WorksUsrCod);
|
||||||
WorksUsrCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
" AND Cod=%ld",
|
||||||
" AND Cod=%ld",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) FileBrowserForExpandedFolders,
|
||||||
(unsigned) FileBrowserForExpandedFolders,
|
Cod);
|
||||||
Cod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // Briefcase
|
else // Briefcase
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET ClickTime=NOW()"
|
" WHERE UsrCod=%ld AND FileBrowser=%u",
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) FileBrowserForExpandedFolders);
|
||||||
(unsigned) FileBrowserForExpandedFolders) < 0)
|
DB_QueryUPDATE_new ("can not update expanded folder");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update expanded folder");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -8188,7 +8173,6 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
||||||
const char *OldPath,const char *NewPath)
|
const char *OldPath,const char *NewPath)
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForExpandedFolders ();
|
long Cod = Brw_GetCodForExpandedFolders ();
|
||||||
char *Query;
|
|
||||||
Brw_FileBrowser_t FileBrowserForExpandedFolders = Brw_FileBrowserForDB_expanded_folders[FileBrowser];
|
Brw_FileBrowser_t FileBrowserForExpandedFolders = Brw_FileBrowserForDB_expanded_folders[FileBrowser];
|
||||||
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
|
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
|
||||||
|
|
||||||
|
@ -8198,68 +8182,53 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
||||||
if (MyUsrCod > 0)
|
if (MyUsrCod > 0)
|
||||||
{
|
{
|
||||||
if (WorksUsrCod > 0)
|
if (WorksUsrCod > 0)
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
" AND Cod=%ld AND WorksUsrCod=%ld"
|
||||||
" AND Cod=%ld AND WorksUsrCod=%ld"
|
" AND Path LIKE '%s/%%'",
|
||||||
" AND Path LIKE '%s/%%'",
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||||
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
Cod,WorksUsrCod,
|
||||||
Cod,WorksUsrCod,
|
OldPath);
|
||||||
OldPath) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
" AND Cod=%ld"
|
||||||
" AND Cod=%ld"
|
" AND Path LIKE '%s/%%'",
|
||||||
" AND Path LIKE '%s/%%'",
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
||||||
MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
|
Cod,
|
||||||
Cod,
|
OldPath);
|
||||||
OldPath) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // MyUsrCod <= 0 means expanded folders for any user
|
else // MyUsrCod <= 0 means expanded folders for any user
|
||||||
{
|
{
|
||||||
if (WorksUsrCod > 0)
|
if (WorksUsrCod > 0)
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
" AND WorksUsrCod=%ld"
|
||||||
" AND WorksUsrCod=%ld"
|
" AND Path LIKE '%s/%%'",
|
||||||
" AND Path LIKE '%s/%%'",
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
(unsigned) FileBrowserForExpandedFolders,Cod,
|
||||||
(unsigned) FileBrowserForExpandedFolders,Cod,
|
WorksUsrCod,
|
||||||
WorksUsrCod,
|
OldPath);
|
||||||
OldPath) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
" AND Path LIKE '%s/%%'",
|
||||||
" AND Path LIKE '%s/%%'",
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
(unsigned) FileBrowserForExpandedFolders,Cod,
|
||||||
(unsigned) FileBrowserForExpandedFolders,Cod,
|
OldPath);
|
||||||
OldPath) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Briefcase
|
else // Briefcase
|
||||||
{
|
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
if (asprintf (&Query,"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
" AND Path LIKE '%s/%%'",
|
||||||
" AND Path LIKE '%s/%%'",
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
MyUsrCod,
|
||||||
MyUsrCod,
|
(unsigned) FileBrowserForExpandedFolders,
|
||||||
(unsigned) FileBrowserForExpandedFolders,
|
OldPath);
|
||||||
OldPath) < 0)
|
DB_QueryUPDATE_new ("can not update expanded folders");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
}
|
|
||||||
DB_QueryUPDATE_free (Query,"can not update expanded folders");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -11745,19 +11714,17 @@ static void Brw_ChangeFileOrFolderHiddenInDB (const char Path[PATH_MAX + 1],bool
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Mark file as hidden in database *****/
|
/***** Mark file as hidden in database *****/
|
||||||
if (asprintf (&Query,"UPDATE files SET Hidden='%c'"
|
DB_BuildQuery ("UPDATE files SET Hidden='%c'"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||||
" AND Path='%s'",
|
" AND Path='%s'",
|
||||||
IsHidden ? 'Y' :
|
IsHidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
Path) < 0)
|
Path);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not change status of a file in database");
|
||||||
DB_QueryUPDATE_free (Query,"can not change status of a file in database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -11769,21 +11736,19 @@ static void Brw_ChangeFilePublicInDB (long PublisherUsrCod,const char *Path,
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Change publisher, public and license of file in database *****/
|
/***** Change publisher, public and license of file in database *****/
|
||||||
if (asprintf (&Query,"UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
|
DB_BuildQuery ("UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||||
" AND Path='%s'",
|
" AND Path='%s'",
|
||||||
PublisherUsrCod,
|
PublisherUsrCod,
|
||||||
IsPublic ? 'Y' :
|
IsPublic ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
(unsigned) License,
|
(unsigned) License,
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
Path) < 0)
|
Path);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not change metadata of a file in database");
|
||||||
DB_QueryUPDATE_free (Query,"can not change metadata of a file in database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -12075,17 +12040,15 @@ static void Brw_RenameOneFolderInDB (const char OldPath[PATH_MAX + 1],
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update file or folder in table of common files *****/
|
/***** Update file or folder in table of common files *****/
|
||||||
if (asprintf (&Query,"UPDATE files SET Path='%s'"
|
DB_BuildQuery ("UPDATE files SET Path='%s'"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'",
|
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'",
|
||||||
NewPath,
|
NewPath,
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
OldPath) < 0)
|
OldPath);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update folder name in a common zone");
|
||||||
DB_QueryUPDATE_free (Query,"can not update folder name in a common zone");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -12097,19 +12060,17 @@ static void Brw_RenameChildrenFilesOrFoldersInDB (const char OldPath[PATH_MAX +
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
char *Query;
|
|
||||||
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
|
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
|
||||||
|
|
||||||
/***** Update children of a folder in table of files *****/
|
/***** Update children of a folder in table of files *****/
|
||||||
if (asprintf (&Query,"UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
DB_BuildQuery ("UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||||
" AND Path LIKE '%s/%%'",
|
" AND Path LIKE '%s/%%'",
|
||||||
NewPath,StartFinalSubpathNotChanged,
|
NewPath,StartFinalSubpathNotChanged,
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
OldPath) < 0)
|
OldPath);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not rename file or folder names in a common zone");
|
||||||
DB_QueryUPDATE_free (Query,"can not rename file or folder names in a common zone");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
100
swad_forum.c
100
swad_forum.c
|
@ -729,14 +729,11 @@ void For_GetForumTypeAndLocationOfAPost (long PstCod,struct Forum *Forum)
|
||||||
|
|
||||||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the code of the first and last posts of a thread *****/
|
/***** Update the code of the first and last posts of a thread *****/
|
||||||
if (asprintf (&Query,"UPDATE forum_thread SET FirstPstCod=%ld,LastPstCod=%ld"
|
DB_BuildQuery ("UPDATE forum_thread SET FirstPstCod=%ld,LastPstCod=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
FirstPstCod,LastPstCod,ThrCod) < 0)
|
FirstPstCod,LastPstCod,ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update a thread of a forum");
|
||||||
DB_QueryUPDATE_free (Query,"can not update a thread of a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -745,14 +742,11 @@ static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long Last
|
||||||
|
|
||||||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the code of the last post of a thread *****/
|
/***** Update the code of the last post of a thread *****/
|
||||||
if (asprintf (&Query,"UPDATE forum_thread SET LastPstCod=%ld"
|
DB_BuildQuery ("UPDATE forum_thread SET LastPstCod=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
LastPstCod,ThrCod) < 0)
|
LastPstCod,ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update a thread of a forum");
|
||||||
DB_QueryUPDATE_free (Query,"can not update a thread of a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4027,14 +4021,11 @@ void For_ReceiveForumPost (void)
|
||||||
|
|
||||||
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail)
|
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
/***** Update number of users notified *****/
|
||||||
if (asprintf (&Query,"UPDATE forum_post SET NumNotif=NumNotif+%u"
|
DB_BuildQuery ("UPDATE forum_post SET NumNotif=NumNotif+%u"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
NumUsrsToBeNotifiedByEMail,PstCod) < 0)
|
NumUsrsToBeNotifiedByEMail,PstCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the number of notifications of a post");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the number of notifications of a post");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4368,8 +4359,6 @@ static bool For_CheckIfThrBelongsToForum (long ThrCod,struct Forum *Forum)
|
||||||
|
|
||||||
static void For_MoveThrToCurrentForum (long ThrCod)
|
static void For_MoveThrToCurrentForum (long ThrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Move a thread to current forum *****/
|
/***** Move a thread to current forum *****/
|
||||||
switch (Gbl.Forum.ForumSelected.Type)
|
switch (Gbl.Forum.ForumSelected.Type)
|
||||||
{
|
{
|
||||||
|
@ -4377,58 +4366,53 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
||||||
case For_FORUM_GLOBAL_TCHS:
|
case For_FORUM_GLOBAL_TCHS:
|
||||||
case For_FORUM__SWAD__USRS:
|
case For_FORUM__SWAD__USRS:
|
||||||
case For_FORUM__SWAD__TCHS:
|
case For_FORUM__SWAD__TCHS:
|
||||||
if (asprintf (&Query,"UPDATE forum_thread"
|
DB_BuildQuery ("UPDATE forum_thread"
|
||||||
" SET ForumType=%u,Location=-1"
|
" SET ForumType=%u,Location=-1"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTIT_USRS:
|
case For_FORUM_INSTIT_USRS:
|
||||||
case For_FORUM_INSTIT_TCHS:
|
case For_FORUM_INSTIT_TCHS:
|
||||||
if (asprintf (&Query,"UPDATE forum_thread"
|
DB_BuildQuery ("UPDATE forum_thread"
|
||||||
" SET ForumType=%u,Location=%ld"
|
" SET ForumType=%u,Location=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||||
Gbl.Forum.ForumSelected.Location,
|
Gbl.Forum.ForumSelected.Location,
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
break;
|
break;
|
||||||
case For_FORUM_CENTRE_USRS:
|
case For_FORUM_CENTRE_USRS:
|
||||||
case For_FORUM_CENTRE_TCHS:
|
case For_FORUM_CENTRE_TCHS:
|
||||||
if (asprintf (&Query,"UPDATE forum_thread"
|
DB_BuildQuery ("UPDATE forum_thread"
|
||||||
" SET ForumType=%u,Location=%ld"
|
" SET ForumType=%u,Location=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||||
Gbl.Forum.ForumSelected.Location,
|
Gbl.Forum.ForumSelected.Location,
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_USRS:
|
case For_FORUM_DEGREE_USRS:
|
||||||
case For_FORUM_DEGREE_TCHS:
|
case For_FORUM_DEGREE_TCHS:
|
||||||
if (asprintf (&Query,"UPDATE forum_thread"
|
DB_BuildQuery ("UPDATE forum_thread"
|
||||||
" SET ForumType=%u,Location=%ld"
|
" SET ForumType=%u,Location=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||||
Gbl.Forum.ForumSelected.Location,
|
Gbl.Forum.ForumSelected.Location,
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
break;
|
break;
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
if (asprintf (&Query,"UPDATE forum_thread"
|
DB_BuildQuery ("UPDATE forum_thread"
|
||||||
" SET ForumType=%u,Location=%ld"
|
" SET ForumType=%u,Location=%ld"
|
||||||
" WHERE ThrCod=%ld",
|
" WHERE ThrCod=%ld",
|
||||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||||
Gbl.Forum.ForumSelected.Location,
|
Gbl.Forum.ForumSelected.Location,
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong forum.");
|
Lay_ShowErrorAndExit ("Wrong forum.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DB_QueryUPDATE_free (Query,"can not move a thread to current forum");
|
DB_QueryUPDATE_new ("can not move a thread to current forum");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
94
swad_game.c
94
swad_game.c
|
@ -1633,12 +1633,11 @@ void Gam_ResetGame (void)
|
||||||
DB_QueryDELETE_free (Query,"can not remove users who are answered a game");
|
DB_QueryDELETE_free (Query,"can not remove users who are answered a game");
|
||||||
|
|
||||||
/***** Reset all the answers in this game *****/
|
/***** Reset all the answers in this game *****/
|
||||||
if (asprintf (&Query,"UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
DB_BuildQuery ("UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
||||||
" WHERE gam_questions.GamCod=%ld"
|
" WHERE gam_questions.GamCod=%ld"
|
||||||
" AND gam_questions.QstCod=gam_answers.QstCod",
|
" AND gam_questions.QstCod=gam_answers.QstCod",
|
||||||
Game.GamCod) < 0)
|
Game.GamCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not reset answers of a game");
|
||||||
DB_QueryUPDATE_free (Query,"can not reset answers of a game");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1657,7 +1656,6 @@ void Gam_ResetGame (void)
|
||||||
void Gam_HideGame (void)
|
void Gam_HideGame (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Game_X_is_now_hidden;
|
extern const char *Txt_Game_X_is_now_hidden;
|
||||||
char *Query;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
|
@ -1670,10 +1668,8 @@ void Gam_HideGame (void)
|
||||||
Lay_ShowErrorAndExit ("You can not hide this game.");
|
Lay_ShowErrorAndExit ("You can not hide this game.");
|
||||||
|
|
||||||
/***** Hide game *****/
|
/***** Hide game *****/
|
||||||
if (asprintf (&Query,"UPDATE games SET Hidden='Y' WHERE GamCod=%ld",
|
DB_BuildQuery ("UPDATE games SET Hidden='Y' WHERE GamCod=%ld",Game.GamCod);
|
||||||
Game.GamCod) < 0)
|
DB_QueryUPDATE_new ("can not hide game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not hide game");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1692,7 +1688,6 @@ void Gam_HideGame (void)
|
||||||
void Gam_UnhideGame (void)
|
void Gam_UnhideGame (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Game_X_is_now_visible;
|
extern const char *Txt_Game_X_is_now_visible;
|
||||||
char *Query;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
|
@ -1705,10 +1700,8 @@ void Gam_UnhideGame (void)
|
||||||
Lay_ShowErrorAndExit ("You can not unhide this game.");
|
Lay_ShowErrorAndExit ("You can not unhide this game.");
|
||||||
|
|
||||||
/***** Show game *****/
|
/***** Show game *****/
|
||||||
if (asprintf (&Query,"UPDATE games SET Hidden='N' WHERE GamCod=%ld",
|
DB_BuildQuery ("UPDATE games SET Hidden='N' WHERE GamCod=%ld",Game.GamCod);
|
||||||
Game.GamCod) < 0)
|
DB_QueryUPDATE_new ("can not show game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryUPDATE_free (Query,"can not show game");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -2231,24 +2224,22 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt)
|
||||||
{
|
{
|
||||||
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
||||||
extern const char *Txt_The_game_has_been_modified;
|
extern const char *Txt_The_game_has_been_modified;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Update the data of the game *****/
|
/***** Update the data of the game *****/
|
||||||
if (asprintf (&Query,"UPDATE games"
|
DB_BuildQuery ("UPDATE games"
|
||||||
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
||||||
"StartTime=FROM_UNIXTIME(%ld),"
|
"StartTime=FROM_UNIXTIME(%ld),"
|
||||||
"EndTime=FROM_UNIXTIME(%ld),"
|
"EndTime=FROM_UNIXTIME(%ld),"
|
||||||
"Title='%s',Txt='%s'"
|
"Title='%s',Txt='%s'"
|
||||||
" WHERE GamCod=%ld",
|
" WHERE GamCod=%ld",
|
||||||
Sco_ScopeDB[Game->Scope],Game->Cod,
|
Sco_ScopeDB[Game->Scope],Game->Cod,
|
||||||
Game->Roles,
|
Game->Roles,
|
||||||
Game->TimeUTC[Gam_START_TIME],
|
Game->TimeUTC[Gam_START_TIME],
|
||||||
Game->TimeUTC[Gam_END_TIME ],
|
Game->TimeUTC[Gam_END_TIME ],
|
||||||
Game->Title,
|
Game->Title,
|
||||||
Txt,
|
Txt,
|
||||||
Game->GamCod) < 0)
|
Game->GamCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update game");
|
||||||
DB_QueryUPDATE_free (Query,"can not update game");
|
|
||||||
|
|
||||||
/***** Update groups *****/
|
/***** Update groups *****/
|
||||||
/* Remove old groups */
|
/* Remove old groups */
|
||||||
|
@ -3296,7 +3287,6 @@ void Gam_RequestRemoveQst (void)
|
||||||
void Gam_RemoveQst (void)
|
void Gam_RemoveQst (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Question_removed;
|
extern const char *Txt_Question_removed;
|
||||||
char *Query;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
long QstCod;
|
long QstCod;
|
||||||
unsigned QstInd;
|
unsigned QstInd;
|
||||||
|
@ -3318,19 +3308,16 @@ void Gam_RemoveQst (void)
|
||||||
Gam_RemAnswersOfAQuestion (QstCod);
|
Gam_RemAnswersOfAQuestion (QstCod);
|
||||||
|
|
||||||
/* Remove the question itself */
|
/* Remove the question itself */
|
||||||
if (asprintf (&Query,"DELETE FROM gam_questions WHERE QstCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_questions WHERE QstCod=%ld",QstCod);
|
||||||
QstCod) < 0)
|
DB_QueryDELETE_new ("can not remove a question");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a question");
|
|
||||||
if (!mysql_affected_rows (&Gbl.mysql))
|
if (!mysql_affected_rows (&Gbl.mysql))
|
||||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
||||||
|
|
||||||
/* Change index of questions greater than this */
|
/* Change index of questions greater than this */
|
||||||
if (asprintf (&Query,"UPDATE gam_questions SET QstInd=QstInd-1"
|
DB_BuildQuery ("UPDATE gam_questions SET QstInd=QstInd-1"
|
||||||
" WHERE GamCod=%ld AND QstInd>%u",
|
" WHERE GamCod=%ld AND QstInd>%u",
|
||||||
Game.GamCod,QstInd) < 0)
|
Game.GamCod,QstInd);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update indexes of questions");
|
||||||
DB_QueryUPDATE_free (Query,"can not update indexes of questions");
|
|
||||||
|
|
||||||
/***** Write message *****/
|
/***** Write message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||||
|
@ -3475,18 +3462,17 @@ static void Gam_ExchangeQuestions (long GamCod,
|
||||||
| 2 | 232 | | 2 | 232 | | 2 | 232 |
|
| 2 | 232 | | 2 | 232 | | 2 | 232 |
|
||||||
+--------+--------+ +--------+--------+ +--------+--------+
|
+--------+--------+ +--------+--------+ +--------+--------+
|
||||||
*/
|
*/
|
||||||
if (asprintf (&Query,"UPDATE gam_questions SET QstInd=%u"
|
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u"
|
||||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||||
QstIndBottom,
|
QstIndBottom,
|
||||||
GamCod,QstCodTop) < 0)
|
GamCod,QstCodTop);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not exchange indexes of questions");
|
||||||
DB_QueryUPDATE_free (Query,"can not exchange indexes of questions");
|
|
||||||
if (asprintf (&Query,"UPDATE gam_questions SET QstInd=%u"
|
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u"
|
||||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||||
QstIndTop,
|
QstIndTop,
|
||||||
GamCod,QstCodBottom) < 0)
|
GamCod,QstCodBottom);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not exchange indexes of questions");
|
||||||
DB_QueryUPDATE_free (Query,"can not exchange indexes of questions");
|
|
||||||
|
|
||||||
/***** Unlock table *****/
|
/***** Unlock table *****/
|
||||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||||
|
|
149
swad_group.c
149
swad_group.c
|
@ -2799,7 +2799,6 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
||||||
|
|
||||||
void Grp_OpenGroupsAutomatically (void)
|
void Grp_OpenGroupsAutomatically (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NumGrpTypes;
|
unsigned NumGrpTypes;
|
||||||
|
@ -2824,18 +2823,16 @@ void Grp_OpenGroupsAutomatically (void)
|
||||||
{
|
{
|
||||||
/***** Open all the closed groups in this course the must be opened
|
/***** Open all the closed groups in this course the must be opened
|
||||||
and with open time in the past ****/
|
and with open time in the past ****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET Open='Y'"
|
DB_BuildQuery ("UPDATE crs_grp SET Open='Y'"
|
||||||
" WHERE GrpTypCod=%ld AND Open='N'",
|
" WHERE GrpTypCod=%ld AND Open='N'",
|
||||||
GrpTypCod) < 0)
|
GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not open groups");
|
||||||
DB_QueryUPDATE_free (Query,"can not open groups");
|
|
||||||
|
|
||||||
/***** To not try to open groups again, set MustBeOpened to false *****/
|
/***** To not try to open groups again, set MustBeOpened to false *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp_types SET MustBeOpened='N'"
|
DB_BuildQuery ("UPDATE crs_grp_types SET MustBeOpened='N'"
|
||||||
" WHERE GrpTypCod=%ld",
|
" WHERE GrpTypCod=%ld",
|
||||||
GrpTypCod) < 0)
|
GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the opening of a type of group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the opening of a type of group");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4039,12 +4036,11 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
||||||
Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
|
|
||||||
/***** Change all groups of this type in course timetable *****/
|
/***** Change all groups of this type in course timetable *****/
|
||||||
if (asprintf (&Query,"UPDATE timetable_crs SET GrpCod=-1"
|
DB_BuildQuery ("UPDATE timetable_crs SET GrpCod=-1"
|
||||||
" WHERE GrpCod IN"
|
" WHERE GrpCod IN"
|
||||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable");
|
||||||
DB_QueryUPDATE_free (Query,"can not update all groups of a type in course timetable");
|
|
||||||
|
|
||||||
/***** Remove all the students in groups of this type *****/
|
/***** Remove all the students in groups of this type *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
||||||
|
@ -4102,10 +4098,9 @@ static void Grp_RemoveGroupCompletely (void)
|
||||||
Svy_RemoveGroup (GrpDat.GrpCod);
|
Svy_RemoveGroup (GrpDat.GrpCod);
|
||||||
|
|
||||||
/***** Change this group in course timetable *****/
|
/***** Change this group in course timetable *****/
|
||||||
if (asprintf (&Query,"UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update a group in course timetable");
|
||||||
DB_QueryUPDATE_free (Query,"can not update a group in course timetable");
|
|
||||||
|
|
||||||
/***** Remove all the students in this group *****/
|
/***** Remove all the students in this group *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
||||||
|
@ -4137,7 +4132,6 @@ void Grp_OpenGroup (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_group_X_is_now_open;
|
extern const char *Txt_The_group_X_is_now_open;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get group code *****/
|
/***** Get group code *****/
|
||||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||||
|
@ -4148,10 +4142,9 @@ void Grp_OpenGroup (void)
|
||||||
Grp_GetDataOfGroupByCod (&GrpDat);
|
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||||
|
|
||||||
/***** Update the table of groups changing open/close status *****/
|
/***** Update the table of groups changing open/close status *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not open a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not open a group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -4172,7 +4165,6 @@ void Grp_CloseGroup (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_group_X_is_now_closed;
|
extern const char *Txt_The_group_X_is_now_closed;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get group code *****/
|
/***** Get group code *****/
|
||||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||||
|
@ -4183,10 +4175,9 @@ void Grp_CloseGroup (void)
|
||||||
Grp_GetDataOfGroupByCod (&GrpDat);
|
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||||
|
|
||||||
/***** Update the table of groups changing open/close status *****/
|
/***** Update the table of groups changing open/close status *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not close a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not close a group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -4207,7 +4198,6 @@ void Grp_EnableFileZonesGrp (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_File_zones_of_the_group_X_are_now_enabled;
|
extern const char *Txt_File_zones_of_the_group_X_are_now_enabled;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get group code *****/
|
/***** Get group code *****/
|
||||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||||
|
@ -4218,10 +4208,9 @@ void Grp_EnableFileZonesGrp (void)
|
||||||
Grp_GetDataOfGroupByCod (&GrpDat);
|
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||||
|
|
||||||
/***** Update the table of groups changing file zones status *****/
|
/***** Update the table of groups changing file zones status *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not enable file zones of a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not enable file zones of a group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -4242,7 +4231,6 @@ void Grp_DisableFileZonesGrp (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_File_zones_of_the_group_X_are_now_disabled;
|
extern const char *Txt_File_zones_of_the_group_X_are_now_disabled;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get group code *****/
|
/***** Get group code *****/
|
||||||
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
if ((Gbl.CurrentCrs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1)
|
||||||
|
@ -4253,10 +4241,9 @@ void Grp_DisableFileZonesGrp (void)
|
||||||
Grp_GetDataOfGroupByCod (&GrpDat);
|
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||||
|
|
||||||
/***** Update the table of groups changing file zones status *****/
|
/***** Update the table of groups changing file zones status *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not disable file zones of a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not disable file zones of a group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -4279,7 +4266,6 @@ void Grp_ChangeGroupType (void)
|
||||||
extern const char *Txt_The_type_of_group_of_the_group_X_has_changed;
|
extern const char *Txt_The_type_of_group_of_the_group_X_has_changed;
|
||||||
long NewGrpTypCod;
|
long NewGrpTypCod;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
|
@ -4306,10 +4292,9 @@ void Grp_ChangeGroupType (void)
|
||||||
else // Group is not in database
|
else // Group is not in database
|
||||||
{
|
{
|
||||||
/* Update the table of groups changing old type by new type */
|
/* Update the table of groups changing old type by new type */
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
|
||||||
NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the type of a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the type of a group");
|
|
||||||
|
|
||||||
/* Create message to show the change made */
|
/* Create message to show the change made */
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4333,7 +4318,6 @@ void Grp_ChangeMandatGrpTyp (void)
|
||||||
extern const char *Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed;
|
extern const char *Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed;
|
||||||
extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_mandatory;
|
extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_mandatory;
|
||||||
extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary;
|
extern const char *Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary;
|
||||||
char *Query;
|
|
||||||
bool NewMandatoryEnrolment;
|
bool NewMandatoryEnrolment;
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
|
@ -4360,12 +4344,11 @@ void Grp_ChangeMandatGrpTyp (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
|
||||||
NewMandatoryEnrolment ? 'Y' :
|
NewMandatoryEnrolment ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update enrolment type of a type of group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4390,7 +4373,6 @@ void Grp_ChangeMultiGrpTyp (void)
|
||||||
extern const char *Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed;
|
extern const char *Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed;
|
||||||
extern const char *Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X;
|
extern const char *Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X;
|
||||||
extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X;
|
extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X;
|
||||||
char *Query;
|
|
||||||
bool NewMultipleEnrolment;
|
bool NewMultipleEnrolment;
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
|
@ -4417,13 +4399,12 @@ void Grp_ChangeMultiGrpTyp (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp_types SET Multiple='%c'"
|
DB_BuildQuery ("UPDATE crs_grp_types SET Multiple='%c'"
|
||||||
" WHERE GrpTypCod=%ld",
|
" WHERE GrpTypCod=%ld",
|
||||||
NewMultipleEnrolment ? 'Y' :
|
NewMultipleEnrolment ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update enrolment type of a type of group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4446,7 +4427,6 @@ void Grp_ChangeMultiGrpTyp (void)
|
||||||
void Grp_ChangeOpenTimeGrpTyp (void)
|
void Grp_ChangeOpenTimeGrpTyp (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_date_time_of_opening_of_groups_has_changed;
|
extern const char *Txt_The_date_time_of_opening_of_groups_has_changed;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get the code of type of group *****/
|
/***** Get the code of type of group *****/
|
||||||
if ((Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0)
|
if ((Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0)
|
||||||
|
@ -4461,15 +4441,14 @@ void Grp_ChangeOpenTimeGrpTyp (void)
|
||||||
|
|
||||||
/***** Update the table of types of group
|
/***** Update the table of types of group
|
||||||
changing the old open time of enrolment by the new *****/
|
changing the old open time of enrolment by the new *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp_types"
|
DB_BuildQuery ("UPDATE crs_grp_types"
|
||||||
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)"
|
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)"
|
||||||
" WHERE GrpTypCod=%ld",
|
" WHERE GrpTypCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC,
|
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC,
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update enrolment type of a type of group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
|
||||||
|
@ -4489,7 +4468,6 @@ void Grp_ChangeMaxStdsGrp (void)
|
||||||
extern const char *Txt_The_group_X_now_has_no_limit_of_students;
|
extern const char *Txt_The_group_X_now_has_no_limit_of_students;
|
||||||
extern const char *Txt_The_maximum_number_of_students_in_the_group_X_is_now_Y;
|
extern const char *Txt_The_maximum_number_of_students_in_the_group_X_is_now_Y;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
unsigned NewMaxStds;
|
unsigned NewMaxStds;
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
|
@ -4520,10 +4498,9 @@ void Grp_ChangeMaxStdsGrp (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Update the table of groups changing the old maximum of students to the new *****/
|
/***** Update the table of groups changing the old maximum of students to the new *****/
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld",
|
||||||
NewMaxStds,Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
NewMaxStds,Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the maximum number of students in a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the maximum number of students in a group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4578,7 +4555,6 @@ void Grp_RenameGroupType (void)
|
||||||
extern const char *Txt_The_type_of_group_X_already_exists;
|
extern const char *Txt_The_type_of_group_X_already_exists;
|
||||||
extern const char *Txt_The_type_of_group_X_has_been_renamed_as_Y;
|
extern const char *Txt_The_type_of_group_X_has_been_renamed_as_Y;
|
||||||
extern const char *Txt_The_name_of_the_type_of_group_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_type_of_group_X_has_not_changed;
|
||||||
char *Query;
|
|
||||||
char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
|
char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
|
@ -4617,12 +4593,11 @@ void Grp_RenameGroupType (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/* Update the table changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE crs_grp_types SET GrpTypName='%s'"
|
DB_BuildQuery ("UPDATE crs_grp_types SET GrpTypName='%s'"
|
||||||
" WHERE GrpTypCod=%ld",
|
" WHERE GrpTypCod=%ld",
|
||||||
NewNameGrpTyp,
|
NewNameGrpTyp,
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the type of a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the type of a group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4658,7 +4633,6 @@ void Grp_RenameGroup (void)
|
||||||
extern const char *Txt_The_group_X_has_been_renamed_as_Y;
|
extern const char *Txt_The_group_X_has_been_renamed_as_Y;
|
||||||
extern const char *Txt_The_name_of_the_group_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_group_X_has_not_changed;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1];
|
char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1];
|
||||||
Ale_AlertType_t AlertType;
|
Ale_AlertType_t AlertType;
|
||||||
|
|
||||||
|
@ -4698,10 +4672,9 @@ void Grp_RenameGroup (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/* Update the table changing old name by new name */
|
||||||
if (asprintf (&Query,"UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
|
DB_BuildQuery ("UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
|
||||||
NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryUPDATE_new ("can not update the name of a group");
|
||||||
DB_QueryUPDATE_free (Query,"can not update the name of a group");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user