mirror of https://github.com/acanas/swad-core.git
Version 18.7.28
This commit is contained in:
parent
43c91ffbfe
commit
ab5f548d49
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.7.27 (2018-10-22)"
|
#define Log_PLATFORM_VERSION "SWAD 18.7.28 (2018-10-22)"
|
||||||
#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.7.28: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237674 lines)
|
||||||
Version 18.7.27: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237661 lines)
|
Version 18.7.27: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237661 lines)
|
||||||
Version 18.7.26: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237600 lines)
|
Version 18.7.26: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237600 lines)
|
||||||
Version 18.7.25: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237538 lines)
|
Version 18.7.25: Oct 22, 2018 Some sprintf for database queries changed by asprintf. (237538 lines)
|
||||||
|
|
|
@ -904,8 +904,8 @@ static unsigned For_GetNumMyPstInThr (long ThrCod)
|
||||||
" WHERE ThrCod=%ld AND UsrCod=%ld",
|
" WHERE ThrCod=%ld AND UsrCod=%ld",
|
||||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
||||||
Lay_NotEnoughMemoryExit ();
|
Lay_NotEnoughMemoryExit ();
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not check if you have written"
|
return (unsigned) DB_QueryCOUNT_free (Query,"can not check if you have written"
|
||||||
" posts in a thead of a forum");
|
" posts in a thead of a forum");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
10
swad_game.c
10
swad_game.c
|
@ -3500,8 +3500,9 @@ static void Gam_ExchangeQuestions (long GamCod,
|
||||||
long QstCodBottom;
|
long QstCodBottom;
|
||||||
|
|
||||||
/***** Lock table to make the inscription atomic *****/
|
/***** Lock table to make the inscription atomic *****/
|
||||||
DB_Query ("LOCK TABLES gam_questions WRITE",
|
if (asprintf (&Query,"LOCK TABLES gam_questions WRITE") < 0)
|
||||||
"Can not lock tables to move game question");
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
DB_Query_free (Query,"can not lock tables to move game question");
|
||||||
Gbl.DB.LockedTables = true;
|
Gbl.DB.LockedTables = true;
|
||||||
|
|
||||||
/***** Get question code of the questions to be moved *****/
|
/***** Get question code of the questions to be moved *****/
|
||||||
|
@ -3537,8 +3538,9 @@ static void Gam_ExchangeQuestions (long GamCod,
|
||||||
/***** 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...
|
||||||
// ...to not retry the unlock if error in unlocking
|
// ...to not retry the unlock if error in unlocking
|
||||||
DB_Query ("UNLOCK TABLES",
|
if (asprintf (&Query,"UNLOCK TABLES") < 0)
|
||||||
"Can not unlock tables after moving game questions");
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
DB_Query_free (Query,"can not unlock tables after moving game questions");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
69
swad_group.c
69
swad_group.c
|
@ -96,6 +96,9 @@ static void Grp_PutIconToCreateNewGroup (void);
|
||||||
|
|
||||||
static void Grp_PutCheckboxAllGrps (Grp_WhichGroups_t GroupsSelectableByStdsOrNETs);
|
static void Grp_PutCheckboxAllGrps (Grp_WhichGroups_t GroupsSelectableByStdsOrNETs);
|
||||||
|
|
||||||
|
static void Grp_LockTables (void);
|
||||||
|
static void Grp_UnlockTables (void);
|
||||||
|
|
||||||
static void Grp_ConstructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
static void Grp_ConstructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
||||||
static void Grp_DestructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
static void Grp_DestructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
||||||
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod);
|
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod);
|
||||||
|
@ -760,10 +763,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
||||||
bool ChangesMade = false;
|
bool ChangesMade = false;
|
||||||
|
|
||||||
/***** Lock tables to make the inscription atomic *****/
|
/***** Lock tables to make the inscription atomic *****/
|
||||||
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
|
Grp_LockTables ();
|
||||||
"crs_grp_usr WRITE,crs_usr READ",
|
|
||||||
"Can not lock tables to change user's groups");
|
|
||||||
Gbl.DB.LockedTables = true;
|
|
||||||
|
|
||||||
/***** Get list of groups types and groups in this course *****/
|
/***** Get list of groups types and groups in this course *****/
|
||||||
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
||||||
|
@ -881,10 +881,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
||||||
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
||||||
|
|
||||||
/***** Unlock tables after changes in my groups *****/
|
/***** Unlock tables after changes in my groups *****/
|
||||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
Grp_UnlockTables ();
|
||||||
// ...to not retry the unlock if error in unlocking
|
|
||||||
DB_Query ("UNLOCK TABLES",
|
|
||||||
"Can not unlock tables after changes in user's groups");
|
|
||||||
|
|
||||||
/***** Free list of groups types and groups in this course *****/
|
/***** Free list of groups types and groups in this course *****/
|
||||||
Grp_FreeListGrpTypesAndGrps ();
|
Grp_FreeListGrpTypesAndGrps ();
|
||||||
|
@ -904,14 +901,9 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
||||||
bool RemoveUsrFromThisGrp;
|
bool RemoveUsrFromThisGrp;
|
||||||
bool RegisterUsrInThisGrp;
|
bool RegisterUsrInThisGrp;
|
||||||
|
|
||||||
|
/***** Lock tables to make the inscription atomic *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
||||||
{
|
Grp_LockTables ();
|
||||||
/***** Lock tables to make the inscription atomic *****/
|
|
||||||
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
|
|
||||||
"crs_grp_usr WRITE,crs_usr READ",
|
|
||||||
"Can not lock tables to change user's groups");
|
|
||||||
Gbl.DB.LockedTables = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Get list of groups types and groups in this course *****/
|
/***** Get list of groups types and groups in this course *****/
|
||||||
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
||||||
|
@ -948,22 +940,47 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
||||||
Grp_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]);
|
Grp_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free memory with the list of groups which I belonged to *****/
|
/***** Free memory with the list of groups which user belonged to *****/
|
||||||
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
|
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
|
||||||
|
|
||||||
/***** Unlock tables after changes in my groups *****/
|
/***** Unlock tables after changes in groups *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
||||||
{
|
Grp_UnlockTables ();
|
||||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
|
||||||
// ...to not retry the unlock if error in unlocking
|
|
||||||
DB_Query ("UNLOCK TABLES",
|
|
||||||
"Can not unlock tables after changes in user's groups");
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free list of groups types and groups in this course *****/
|
/***** Free list of groups types and groups in this course *****/
|
||||||
Grp_FreeListGrpTypesAndGrps ();
|
Grp_FreeListGrpTypesAndGrps ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Lock tables to make the registration in groups atomic ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Grp_LockTables (void)
|
||||||
|
{
|
||||||
|
char *Query;
|
||||||
|
|
||||||
|
if (asprintf (&Query,"LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
|
||||||
|
"crs_grp_usr WRITE,crs_usr READ") < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
DB_Query_free (Query,"can not lock tables to change user's groups");
|
||||||
|
Gbl.DB.LockedTables = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Unlock tables after changes in registration in groups ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Grp_UnlockTables (void)
|
||||||
|
{
|
||||||
|
char *Query;
|
||||||
|
|
||||||
|
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||||
|
// ...to not retry the unlock if error in unlocking
|
||||||
|
if (asprintf (&Query,"UNLOCK TABLES") < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
DB_Query_free (Query,"can not unlock tables after changing user's groups");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******* Check if not selected more than a group of single enrolment *********/
|
/******* Check if not selected more than a group of single enrolment *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3326,8 +3343,8 @@ bool Grp_GetIfIBelongToGrp (long GrpCod)
|
||||||
GrpCod,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
GrpCod,Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
||||||
Lay_NotEnoughMemoryExit ();
|
Lay_NotEnoughMemoryExit ();
|
||||||
Gbl.Cache.IBelongToGrp.GrpCod = GrpCod;
|
Gbl.Cache.IBelongToGrp.GrpCod = GrpCod;
|
||||||
Gbl.Cache.IBelongToGrp.IBelong = (DB_QueryCOUNT (Query,"can not check"
|
Gbl.Cache.IBelongToGrp.IBelong = (DB_QueryCOUNT_free (Query,"can not check"
|
||||||
" if you belong to a group") != 0);
|
" if you belong to a group") != 0);
|
||||||
return Gbl.Cache.IBelongToGrp.IBelong;
|
return Gbl.Cache.IBelongToGrp.IBelong;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4678,7 +4695,7 @@ void Grp_RenameGroupType (void)
|
||||||
NewNameGrpTyp,
|
NewNameGrpTyp,
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
||||||
Lay_NotEnoughMemoryExit ();
|
Lay_NotEnoughMemoryExit ();
|
||||||
DB_QueryUPDATE (Query,"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;
|
||||||
|
|
Loading…
Reference in New Issue