mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version19.19.3
This commit is contained in:
parent
c3d247c91a
commit
f19733e00e
|
@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.19.2 (2019-09-29)"
|
#define Log_PLATFORM_VERSION "SWAD 19.19.3 (2019-09-29)"
|
||||||
#define CSS_FILE "swad19.15.css"
|
#define CSS_FILE "swad19.15.css"
|
||||||
#define JS_FILE "swad19.15.js"
|
#define JS_FILE "swad19.15.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.19.3: Sep 29, 2019 Students will not see matches results for groups to which they don't belong. (246645 lines)
|
||||||
Version 19.19.2: Sep 29, 2019 Students will not see icons to remove matches. (246619 lines)
|
Version 19.19.2: Sep 29, 2019 Students will not see icons to remove matches. (246619 lines)
|
||||||
Version 19.19.1: Sep 29, 2019 Students will not see matches for groups to which they don't belong. (246601 lines)
|
Version 19.19.1: Sep 29, 2019 Students will not see matches for groups to which they don't belong. (246601 lines)
|
||||||
Version 19.19: Sep 29, 2019 Selections of my groups/all groups in listing of matches.
|
Version 19.19: Sep 29, 2019 Selections of my groups/all groups in listing of matches.
|
||||||
|
|
|
@ -473,8 +473,9 @@ void Gam_ShowOneGame (long GamCod,
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
|
Gam_CurrentGamCod = GamCod;
|
||||||
Frm_StartForm (ActSeeGam);
|
Frm_StartForm (ActSeeGam);
|
||||||
Gam_PutParamGameCod (GamCod);
|
Gam_PutParams ();
|
||||||
Frm_LinkFormSubmit (Txt_Matches,
|
Frm_LinkFormSubmit (Txt_Matches,
|
||||||
Game.Status.Visible ? "ASG_TITLE" :
|
Game.Status.Visible ? "ASG_TITLE" :
|
||||||
"ASG_TITLE_LIGHT",NULL);
|
"ASG_TITLE_LIGHT",NULL);
|
||||||
|
|
102
swad_match.c
102
swad_match.c
|
@ -115,7 +115,7 @@ static void Mch_PutIconToPlayNewMatch (void);
|
||||||
static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
||||||
unsigned NumMatches,
|
unsigned NumMatches,
|
||||||
MYSQL_RES *mysql_res);
|
MYSQL_RES *mysql_res);
|
||||||
static void Mch_ListOneOrMoreMatchesHeading (void);
|
static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches);
|
||||||
static bool Mch_CheckIfICanEditMatches (void);
|
static bool Mch_CheckIfICanEditMatches (void);
|
||||||
static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match);
|
static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match);
|
||||||
static void Mch_ListOneOrMoreMatchesAuthor (const struct Match *Match);
|
static void Mch_ListOneOrMoreMatchesAuthor (const struct Match *Match);
|
||||||
|
@ -123,8 +123,10 @@ static void Mch_ListOneOrMoreMatchesTimes (const struct Match *Match,unsigned Un
|
||||||
static void Mch_ListOneOrMoreMatchesTitleGrps (const struct Match *Match);
|
static void Mch_ListOneOrMoreMatchesTitleGrps (const struct Match *Match);
|
||||||
static void Mch_GetAndWriteNamesOfGrpsAssociatedToMatch (const struct Match *Match);
|
static void Mch_GetAndWriteNamesOfGrpsAssociatedToMatch (const struct Match *Match);
|
||||||
static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Match *Match);
|
static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Match *Match);
|
||||||
static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned NumQsts);
|
static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned NumQsts,
|
||||||
static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match);
|
bool ICanPlayThisMatchBasedOnGrps);
|
||||||
|
static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
|
||||||
|
bool ICanPlayThisMatchBasedOnGrps);
|
||||||
|
|
||||||
static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||||
struct Match *Match);
|
struct Match *Match);
|
||||||
|
@ -165,7 +167,6 @@ static void Mch_SetMatchStatusToEnd (struct Match *Match);
|
||||||
|
|
||||||
static void Mch_ShowMatchStatusForTch (struct Match *Match);
|
static void Mch_ShowMatchStatusForTch (struct Match *Match);
|
||||||
static void Mch_ShowMatchStatusForStd (struct Match *Match);
|
static void Mch_ShowMatchStatusForStd (struct Match *Match);
|
||||||
static bool Mch_CheckIfIPlayThisMatchBasedOnGrps (long MchCod);
|
|
||||||
|
|
||||||
static void Mch_ShowLeftColumnTch (struct Match *Match);
|
static void Mch_ShowLeftColumnTch (struct Match *Match);
|
||||||
static void Mch_ShowInsideLeftColumnTch (struct Match *Match);
|
static void Mch_ShowInsideLeftColumnTch (struct Match *Match);
|
||||||
|
@ -380,10 +381,12 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
||||||
unsigned NumMatch;
|
unsigned NumMatch;
|
||||||
unsigned UniqueId;
|
unsigned UniqueId;
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
bool ICanPlayThisMatchBasedOnGrps;
|
||||||
|
bool ICanEditMatches = Mch_CheckIfICanEditMatches ();
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Write the heading *****/
|
||||||
Tbl_StartTableWideMargin (2);
|
Tbl_StartTableWideMargin (2);
|
||||||
Mch_ListOneOrMoreMatchesHeading ();
|
Mch_ListOneOrMoreMatchesHeading (ICanEditMatches);
|
||||||
|
|
||||||
/***** Write rows *****/
|
/***** Write rows *****/
|
||||||
for (NumMatch = 0, UniqueId = 1;
|
for (NumMatch = 0, UniqueId = 1;
|
||||||
|
@ -394,12 +397,13 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
||||||
|
|
||||||
/***** Get match data from row *****/
|
/***** Get match data from row *****/
|
||||||
Mch_GetMatchDataFromRow (mysql_res,&Match);
|
Mch_GetMatchDataFromRow (mysql_res,&Match);
|
||||||
|
ICanPlayThisMatchBasedOnGrps = Mch_CheckIfICanPlayThisMatchBasedOnGrps (Match.MchCod);
|
||||||
|
|
||||||
/***** Write row for this match ****/
|
/***** Write row for this match ****/
|
||||||
fprintf (Gbl.F.Out,"<tr>");
|
fprintf (Gbl.F.Out,"<tr>");
|
||||||
|
|
||||||
/* Icons */
|
/* Icons */
|
||||||
if (Mch_CheckIfICanEditMatches ())
|
if (ICanEditMatches)
|
||||||
Mch_ListOneOrMoreMatchesIcons (&Match);
|
Mch_ListOneOrMoreMatchesIcons (&Match);
|
||||||
|
|
||||||
/* Match player */
|
/* Match player */
|
||||||
|
@ -415,10 +419,12 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
||||||
Mch_ListOneOrMoreMatchesNumPlayers (&Match);
|
Mch_ListOneOrMoreMatchesNumPlayers (&Match);
|
||||||
|
|
||||||
/* Match status */
|
/* Match status */
|
||||||
Mch_ListOneOrMoreMatchesStatus (&Match,Game->NumQsts);
|
Mch_ListOneOrMoreMatchesStatus (&Match,Game->NumQsts,
|
||||||
|
ICanPlayThisMatchBasedOnGrps);
|
||||||
|
|
||||||
/* Match result visible? */
|
/* Match result visible? */
|
||||||
Mch_ListOneOrMoreMatchesResult (&Match);
|
Mch_ListOneOrMoreMatchesResult (&Match,
|
||||||
|
ICanPlayThisMatchBasedOnGrps);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</tr>");
|
fprintf (Gbl.F.Out,"</tr>");
|
||||||
}
|
}
|
||||||
|
@ -431,7 +437,7 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
|
||||||
/***************** Put a column for match start and end times ****************/
|
/***************** Put a column for match start and end times ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mch_ListOneOrMoreMatchesHeading (void)
|
static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches)
|
||||||
{
|
{
|
||||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||||
|
@ -444,7 +450,7 @@ static void Mch_ListOneOrMoreMatchesHeading (void)
|
||||||
fprintf (Gbl.F.Out,"<tr>");
|
fprintf (Gbl.F.Out,"<tr>");
|
||||||
|
|
||||||
/***** Column for icons *****/
|
/***** Column for icons *****/
|
||||||
if (Mch_CheckIfICanEditMatches ())
|
if (ICanEditMatches)
|
||||||
fprintf (Gbl.F.Out,"<th></th>");
|
fprintf (Gbl.F.Out,"<th></th>");
|
||||||
|
|
||||||
/***** The rest of columns *****/
|
/***** The rest of columns *****/
|
||||||
|
@ -659,11 +665,11 @@ static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Match *Match)
|
||||||
/********************** Put a column for match status ************************/
|
/********************** Put a column for match status ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned NumQsts)
|
static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned NumQsts,
|
||||||
|
bool ICanPlayThisMatchBasedOnGrps)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Play;
|
extern const char *Txt_Play;
|
||||||
extern const char *Txt_Resume;
|
extern const char *Txt_Resume;
|
||||||
bool IBelongToGroups;
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP COLOR%u\">",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP COLOR%u\">",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
@ -675,8 +681,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
IBelongToGroups = Mch_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
|
if (ICanPlayThisMatchBasedOnGrps)
|
||||||
if (IBelongToGroups)
|
|
||||||
{
|
{
|
||||||
/* Icon to play as student */
|
/* Icon to play as student */
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Mch_CurrentMchCod = Match->MchCod;
|
||||||
|
@ -709,7 +714,8 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N
|
||||||
/**************** Put a column for visibility of match result ****************/
|
/**************** Put a column for visibility of match result ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match)
|
static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
|
||||||
|
bool ICanPlayThisMatchBasedOnGrps)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Match_result;
|
extern const char *Txt_Match_result;
|
||||||
extern const char *Txt_Hidden_result;
|
extern const char *Txt_Hidden_result;
|
||||||
|
@ -720,22 +726,22 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match)
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
/* Match result visible or hidden? */
|
if (ICanPlayThisMatchBasedOnGrps)
|
||||||
if (Match->Status.ShowUsrResults)
|
|
||||||
{
|
{
|
||||||
Frm_StartForm (ActSeeOneMchResMe);
|
/* Match result visible or hidden? */
|
||||||
Mch_PutParamMchCod (Match->MchCod);
|
if (Match->Status.ShowUsrResults)
|
||||||
Ico_PutIconLink ("tasks.svg",Txt_Match_result);
|
{
|
||||||
Frm_EndForm ();
|
Frm_StartForm (ActSeeOneMchResMe);
|
||||||
|
Mch_PutParamMchCod (Match->MchCod);
|
||||||
|
Ico_PutIconLink ("tasks.svg",Txt_Match_result);
|
||||||
|
Frm_EndForm ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ico_PutIconOff ("eye-slash.svg",Txt_Hidden_result);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Ico_PutIconOff ("eye-slash.svg",Txt_Hidden_result);
|
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_DEG_ADM:
|
|
||||||
case Rol_CTR_ADM:
|
|
||||||
case Rol_INS_ADM:
|
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/* Match result visible or hidden? */
|
/* Match result visible or hidden? */
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Mch_CurrentMchCod = Match->MchCod;
|
||||||
|
@ -1931,12 +1937,11 @@ static void Mch_ShowMatchStatusForTch (struct Match *Match)
|
||||||
|
|
||||||
static void Mch_ShowMatchStatusForStd (struct Match *Match)
|
static void Mch_ShowMatchStatusForStd (struct Match *Match)
|
||||||
{
|
{
|
||||||
bool IBelongToGroups;
|
bool ICanPlayThisMatchBasedOnGrps;
|
||||||
|
|
||||||
/***** Do I belong to valid groups to play this match? *****/
|
/***** Can I play this match? *****/
|
||||||
IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
ICanPlayThisMatchBasedOnGrps = Mch_CheckIfICanPlayThisMatchBasedOnGrps (Match->MchCod);
|
||||||
Mch_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
|
if (!ICanPlayThisMatchBasedOnGrps)
|
||||||
if (!IBelongToGroups)
|
|
||||||
Lay_ShowErrorAndExit ("You can not play this match!");
|
Lay_ShowErrorAndExit ("You can not play this match!");
|
||||||
|
|
||||||
/***** Left column *****/
|
/***** Left column *****/
|
||||||
|
@ -1968,17 +1973,32 @@ unsigned Mch_GetNumMchsInGame (long GamCod)
|
||||||
/************ Check if I belong to any of the groups of a match **************/
|
/************ Check if I belong to any of the groups of a match **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool Mch_CheckIfIPlayThisMatchBasedOnGrps (long MchCod)
|
bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (long MchCod)
|
||||||
{
|
{
|
||||||
/***** Get if I can play a match from database *****/
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
return (DB_QueryCOUNT ("can not check if I can play a match",
|
{
|
||||||
"SELECT COUNT(*) FROM mch_matches"
|
case Rol_STD:
|
||||||
" WHERE MchCod=%ld"
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
" AND (MchCod NOT IN (SELECT MchCod FROM mch_groups) OR"
|
/***** Get if I can play a match from database *****/
|
||||||
" MchCod IN (SELECT mch_groups.MchCod FROM mch_groups,crs_grp_usr"
|
return (DB_QueryCOUNT ("can not check if I can play a match",
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
"SELECT COUNT(*) FROM mch_matches"
|
||||||
" AND mch_groups.GrpCod=crs_grp_usr.GrpCod))",
|
" WHERE MchCod=%ld"
|
||||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
" AND (MchCod NOT IN (SELECT MchCod FROM mch_groups) OR"
|
||||||
|
" MchCod IN (SELECT mch_groups.MchCod FROM mch_groups,crs_grp_usr"
|
||||||
|
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||||
|
" AND mch_groups.GrpCod=crs_grp_usr.GrpCod))",
|
||||||
|
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case Rol_NET:
|
||||||
|
case Rol_TCH:
|
||||||
|
return Gbl.Usrs.Me.IBelongToCurrentCrs;
|
||||||
|
case Rol_SYS_ADM:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -107,6 +107,8 @@ void Mch_ForwardMatchTch (void);
|
||||||
|
|
||||||
unsigned Mch_GetNumMchsInGame (long GamCod);
|
unsigned Mch_GetNumMchsInGame (long GamCod);
|
||||||
|
|
||||||
|
bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (long MchCod);
|
||||||
|
|
||||||
void Mch_GetMatchBeingPlayed (void);
|
void Mch_GetMatchBeingPlayed (void);
|
||||||
void Mch_ShowMatchToMeAsStd (void);
|
void Mch_ShowMatchToMeAsStd (void);
|
||||||
void Mch_RefreshMatchTch (void);
|
void Mch_RefreshMatchTch (void);
|
||||||
|
|
|
@ -664,6 +664,7 @@ void Mch_ShowOneMchResult (void)
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
bool ICanPlayThisMatchBasedOnGrps;
|
||||||
bool ICanViewResult;
|
bool ICanViewResult;
|
||||||
bool ICanViewScore;
|
bool ICanViewScore;
|
||||||
|
|
||||||
|
@ -705,7 +706,10 @@ void Mch_ShowOneMchResult (void)
|
||||||
switch (MeOrOther)
|
switch (MeOrOther)
|
||||||
{
|
{
|
||||||
case Usr_ME:
|
case Usr_ME:
|
||||||
ICanViewResult = ItsMe && Match.Status.ShowUsrResults;
|
ICanPlayThisMatchBasedOnGrps = Mch_CheckIfICanPlayThisMatchBasedOnGrps (Match.MchCod);
|
||||||
|
ICanViewResult = ItsMe && ICanPlayThisMatchBasedOnGrps &&
|
||||||
|
Match.Status.ShowUsrResults;
|
||||||
|
|
||||||
if (ICanViewResult)
|
if (ICanViewResult)
|
||||||
{
|
{
|
||||||
Tst_GetConfigTstFromDB (); // To get feedback type
|
Tst_GetConfigTstFromDB (); // To get feedback type
|
||||||
|
|
Loading…
Reference in New Issue
Block a user