diff --git a/swad_action.c b/swad_action.c
index f6464137a..f59143694 100644
--- a/swad_action.c
+++ b/swad_action.c
@@ -5492,4 +5492,3 @@ void Act_NoPermissionExit (void)
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
}
-
diff --git a/swad_centre.c b/swad_centre.c
index 98a71e26f..a251ce9fe 100644
--- a/swad_centre.c
+++ b/swad_centre.c
@@ -2511,7 +2511,7 @@ static void Ctr_PutFormToCreateCentre (void)
else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Frm_StartForm (ActReqCtr);
else
- Lay_ShowErrorAndExit ("You can not edit centres.");
+ Act_NoPermissionExit ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_New_centre,NULL,
diff --git a/swad_changelog.h b/swad_changelog.h
index 6d0cfc4f6..95c02fdc1 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -474,11 +474,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.23 (2019-09-29)"
+#define Log_PLATFORM_VERSION "SWAD 19.24.1 (2019-09-30)"
#define CSS_FILE "swad19.15.css"
#define JS_FILE "swad19.15.js"
/*
- Version 19.23: Sep 29, 2019 Non-editing teachers can not remove matches from other teachers. (246730 lines)
+ Version 19.24.1: Sep 30, 2019 Fixed bug in match results. (246759 lines)
+ Version 19.24: Sep 30, 2019 Non-editing teachers can not change visibility of matches created by other teachers.
+ Non-editing teachers can not resume matches created by other teachers. (246755 lines)
+ Version 19.23: Sep 29, 2019 Non-editing teachers can not remove matches created by other teachers. (246730 lines)
Version 19.22: Sep 29, 2019 Remove user from match tables in course. (246703 lines)
Version 19.21: Sep 29, 2019 Code refactoring in games and matches. (246674 lines)
Version 19.20: Sep 29, 2019 Code refactoring in games and matches. (246631 lines)
diff --git a/swad_course.c b/swad_course.c
index 972957adc..c4a1e1994 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -1694,7 +1694,7 @@ static void Crs_PutFormToCreateCourse (void)
else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Frm_StartForm (ActReqCrs);
else
- Lay_ShowErrorAndExit ("You can not edit courses.");
+ Act_NoPermissionExit ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_New_course,NULL,
diff --git a/swad_degree.c b/swad_degree.c
index 6b31b40d2..2366b2a8e 100644
--- a/swad_degree.c
+++ b/swad_degree.c
@@ -955,7 +955,7 @@ static void Deg_PutFormToCreateDegree (void)
else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Frm_StartForm (ActReqDeg);
else
- Lay_ShowErrorAndExit ("You can not edit degrees.");
+ Act_NoPermissionExit ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_New_degree,NULL,
diff --git a/swad_forum.c b/swad_forum.c
index 2aea8386b..59dafce5a 100644
--- a/swad_forum.c
+++ b/swad_forum.c
@@ -4170,11 +4170,11 @@ void For_RemovePost (void)
/* Check if I am the author of the message */
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
if (!ItsMe)
- Lay_ShowErrorAndExit ("You can not remove post because you aren't the author.");
+ Act_NoPermissionExit ();
/* Check if the message is the last message in the thread */
if (Gbl.Forum.ForumSelected.PstCod != For_GetLastPstCod (Gbl.Forum.ForumSelected.ThrCod))
- Lay_ShowErrorAndExit ("You can not remove post because it is not the last of the thread.");
+ Act_NoPermissionExit ();
/***** Remove the post *****/
ThreadDeleted = For_RemoveForumPst (Gbl.Forum.ForumSelected.PstCod,Media.MedCod);
@@ -4306,7 +4306,7 @@ void For_RemoveThread (void)
Ale_SUCCESS,Txt_Thread_removed);
}
else
- Lay_ShowErrorAndExit ("You can not remove threads in this forum.");
+ Act_NoPermissionExit ();
}
/*****************************************************************************/
diff --git a/swad_game.c b/swad_game.c
index fdd600ccb..b1ddf2b44 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -915,7 +915,7 @@ void Gam_AskRemGame (void)
/***** Get data of the game from database *****/
Gam_GetDataOfGameByCod (&Game);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not remove this game.");
+ Act_NoPermissionExit ();
/***** Show question and button to remove game *****/
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
@@ -944,7 +944,7 @@ void Gam_RemoveGame (void)
/***** Get data of the game from database *****/
Gam_GetDataOfGameByCod (&Game);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not remove this game.");
+ Act_NoPermissionExit ();
/***** Remove game from all tables *****/
Gam_RemoveGameFromAllTables (Game.GamCod);
@@ -1016,7 +1016,7 @@ void Gam_HideGame (void)
/***** Get data of the game from database *****/
Gam_GetDataOfGameByCod (&Game);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not hide this game.");
+ Act_NoPermissionExit ();
/***** Hide game *****/
DB_QueryUPDATE ("can not hide game",
@@ -1042,7 +1042,7 @@ void Gam_UnhideGame (void)
/***** Get data of the game from database *****/
Gam_GetDataOfGameByCod (&Game);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not unhide this game.");
+ Act_NoPermissionExit ();
/***** Show game *****/
DB_QueryUPDATE ("can not show game",
@@ -1099,7 +1099,7 @@ void Gam_RequestCreatOrEditGame (void)
{
/***** Put link (form) to create new game *****/
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not create a new game here.");
+ Act_NoPermissionExit ();
/* Initialize to empty game */
Gam_ResetGame (&Game);
@@ -1109,7 +1109,7 @@ void Gam_RequestCreatOrEditGame (void)
/* Get data of the game from database */
Gam_GetDataOfGameByCod (&Game);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not update this game.");
+ Act_NoPermissionExit ();
/* Get text of the game from database */
Gam_GetGameTxtFromDB (Game.GamCod,Txt);
@@ -1208,7 +1208,7 @@ void Gam_RecFormGame (void)
OldGame.GamCod = NewGame.GamCod;
Gam_GetDataOfGameByCod (&OldGame);
if (!Gam_CheckIfICanEditGames ())
- Lay_ShowErrorAndExit ("You can not update this game.");
+ Act_NoPermissionExit ();
}
/***** Get game title *****/
diff --git a/swad_institution.c b/swad_institution.c
index 0858d2e66..1ac81562a 100644
--- a/swad_institution.c
+++ b/swad_institution.c
@@ -2230,7 +2230,7 @@ static void Ins_PutFormToCreateInstitution (void)
else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Frm_StartForm (ActReqIns);
else
- Lay_ShowErrorAndExit ("You can not edit institutions.");
+ Act_NoPermissionExit ();
/***** Start box and table *****/
Box_StartBoxTable (NULL,Txt_New_institution,NULL,
diff --git a/swad_match.c b/swad_match.c
index cd566a9ff..c0083d03c 100644
--- a/swad_match.c
+++ b/swad_match.c
@@ -100,7 +100,7 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game,
MYSQL_RES *mysql_res);
static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches);
static bool Mch_CheckIfICanEditMatches (void);
-static bool Mch_CheckIfICanRemoveMatch (const struct Match *Match);
+static bool Mch_CheckIfICanEditThisMatch (const struct Match *Match);
static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match);
static void Mch_ListOneOrMoreMatchesAuthor (const struct Match *Match);
static void Mch_ListOneOrMoreMatchesTimes (const struct Match *Match,unsigned UniqueId);
@@ -122,8 +122,8 @@ static void Mch_RemoveMatchesInGameFromTable (long GamCod,const char *TableName)
static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName);
static void Mch_RemoveUsrMchResultsInCrs (long UsrCod,long CrsCod,const char *TableName);
-static void Mch_PutParamsEdit (void);
static void Mch_PutParamsPlay (void);
+static void Mch_PutParamMchCod (long MchCod);
static void Mch_PutFormNewMatch (struct Game *Game);
static void Mch_ShowLstGrpsToCreateMatch (void);
@@ -191,7 +191,6 @@ static unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsi
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
-static void Mch_SetParamCurrentMchCod (long MchCod);
static long Mch_GetParamCurrentMchCod (void);
/*****************************************************************************/
@@ -494,10 +493,10 @@ static bool Mch_CheckIfICanEditMatches (void)
}
/*****************************************************************************/
-/*********************** Check if I can remove a match ***********************/
+/***************** Check if I can edit (remove/resume) a match ***************/
/*****************************************************************************/
-static bool Mch_CheckIfICanRemoveMatch (const struct Match *Match)
+static bool Mch_CheckIfICanEditThisMatch (const struct Match *Match)
{
switch (Gbl.Usrs.Me.Role.Logged)
{
@@ -520,7 +519,7 @@ static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match)
fprintf (Gbl.F.Out,"
",Gbl.RowEvenOdd);
/***** Put icon to remove the match *****/
- if (Mch_CheckIfICanRemoveMatch (Match))
+ if (Mch_CheckIfICanEditThisMatch (Match))
{
Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
@@ -708,12 +707,15 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N
case Rol_TCH:
case Rol_SYS_ADM:
/* Icon to resume */
- Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
- Lay_PutContextualLinkOnlyIcon (ActResMch,NULL,
- Mch_PutParamsPlay,
- Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
- "flag-checkered.svg",
- Txt_Resume);
+ if (Mch_CheckIfICanEditThisMatch (Match))
+ {
+ Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
+ Lay_PutContextualLinkOnlyIcon (ActResMch,NULL,
+ Mch_PutParamsPlay,
+ Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
+ "flag-checkered.svg",
+ Txt_Resume);
+ }
break;
default:
break;
@@ -743,6 +745,7 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
/* Match result visible or hidden? */
if (Match->Status.ShowUsrResults)
{
+ /* Result is visible by me */
Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
Frm_StartForm (ActSeeOneMchResMe);
@@ -751,6 +754,7 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
Frm_EndForm ();
}
else
+ /* Result is forbidden to me */
Ico_PutIconOff ("eye-slash.svg",Txt_Hidden_result);
}
break;
@@ -758,14 +762,24 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
case Rol_TCH:
case Rol_SYS_ADM:
/* Match result visible or hidden? */
- Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
- Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
- Lay_PutContextualLinkOnlyIcon (ActChgVisResMchUsr,NULL,
- Mch_PutParamsEdit,
- Match->Status.ShowUsrResults ? "eye.svg" :
- "eye-slash.svg",
- Match->Status.ShowUsrResults ? Txt_Visible_result :
- Txt_Hidden_result);
+ if (Mch_CheckIfICanEditThisMatch (Match))
+ {
+ /* I can edit visibility */
+ Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
+ Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
+ Lay_PutContextualLinkOnlyIcon (ActChgVisResMchUsr,NULL,
+ Mch_PutParamsEdit,
+ Match->Status.ShowUsrResults ? "eye.svg" :
+ "eye-slash.svg",
+ Match->Status.ShowUsrResults ? Txt_Visible_result :
+ Txt_Hidden_result);
+ }
+ else
+ /* I can not edit visibility */
+ Ico_PutIconOff (Match->Status.ShowUsrResults ? "eye.svg" :
+ "eye-slash.svg",
+ Match->Status.ShowUsrResults ? Txt_Visible_result :
+ Txt_Hidden_result);
break;
default:
break;
@@ -786,6 +800,10 @@ void Mch_ToggleVisibilResultsMchUsr (void)
/***** Get and check parameters *****/
Mch_GetAndCheckParameters (&Game,&Match);
+ /***** Check if I have permission to change visibility *****/
+ if (!Mch_CheckIfICanEditThisMatch (&Match))
+ Act_NoPermissionExit ();
+
/***** Toggle visibility of match results *****/
Match.Status.ShowUsrResults = !Match.Status.ShowUsrResults;
DB_QueryUPDATE ("can not toggle visibility of match results",
@@ -938,8 +956,8 @@ void Mch_RemoveMatch (void)
Mch_GetAndCheckParameters (&Game,&Match);
/***** Check if I can remove this match *****/
- if (!Mch_CheckIfICanRemoveMatch (&Match))
- Lay_ShowErrorAndExit ("You can not remove this match.");
+ if (!Mch_CheckIfICanEditThisMatch (&Match))
+ Act_NoPermissionExit ();
/***** Remove the match from all database tables *****/
Mch_RemoveMatchFromAllTables (Match.MchCod);
@@ -1095,7 +1113,7 @@ static void Mch_RemoveUsrMchResultsInCrs (long UsrCod,long CrsCod,const char *Ta
/*********************** Params used to edit a match *************************/
/*****************************************************************************/
-static void Mch_PutParamsEdit (void)
+void Mch_PutParamsEdit (void)
{
Gam_PutParams ();
Mch_PutParamsPlay ();
@@ -1117,7 +1135,7 @@ static void Mch_PutParamsPlay (void)
/******************** Write parameter with code of match **********************/
/*****************************************************************************/
-void Mch_PutParamMchCod (long MchCod)
+static void Mch_PutParamMchCod (long MchCod)
{
Par_PutHiddenParamLong ("MchCod",MchCod);
}
@@ -1322,6 +1340,10 @@ void Mch_ResumeMatch (void)
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
Mch_GetDataOfMatchByCod (&Match);
+ /***** Check if I have permission to resume match *****/
+ if (!Mch_CheckIfICanEditThisMatch (&Match))
+ Act_NoPermissionExit ();
+
/***** Update match status in database *****/
Mch_UpdateMatchStatusInDB (&Match);
@@ -2000,7 +2022,7 @@ static void Mch_ShowMatchStatusForStd (struct Match *Match)
/***** Can I play this match? *****/
ICanPlayThisMatchBasedOnGrps = Mch_CheckIfICanPlayThisMatchBasedOnGrps (Match->MchCod);
if (!ICanPlayThisMatchBasedOnGrps)
- Lay_ShowErrorAndExit ("You can not play this match!");
+ Act_NoPermissionExit ();
/***** Left column *****/
Mch_ShowLeftColumnStd (Match);
@@ -3079,7 +3101,7 @@ static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQs
/**************** Access to variable used to pass parameter ******************/
/*****************************************************************************/
-static void Mch_SetParamCurrentMchCod (long MchCod)
+void Mch_SetParamCurrentMchCod (long MchCod)
{
Mch_CurrentMchCod = MchCod;
}
diff --git a/swad_match.h b/swad_match.h
index 88831c177..9040b0bcd 100644
--- a/swad_match.h
+++ b/swad_match.h
@@ -89,7 +89,7 @@ void Mch_RemoveMatchesInGameFromAllTables (long GamCod);
void Mch_RemoveMatchInCourseFromAllTables (long CrsCod);
void Mch_RemoveUsrFromMatchTablesInCrs (long UsrCod,long CrsCod);
-void Mch_PutParamMchCod (long MchCod);
+void Mch_PutParamsEdit (void);
void Mch_GetAndCheckParameters (struct Game *Game,struct Match *Match);
long Mch_GetParamMchCod (void);
@@ -124,4 +124,6 @@ void Mch_GetAndDrawBarNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsig
unsigned NumAnswerersQst,bool Correct);
unsigned Mch_GetNumUsrsWhoHaveAnswerQst (long MchCod,unsigned QstInd);
+void Mch_SetParamCurrentMchCod (long MchCod);
+
#endif
diff --git a/swad_match_result.c b/swad_match_result.c
index afda8d91f..6e6fb5e9a 100644
--- a/swad_match_result.c
+++ b/swad_match_result.c
@@ -385,7 +385,7 @@ static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
unsigned NumResults;
unsigned NumResult;
static unsigned UniqueId = 0;
- long MchCod;
+ struct Match Match;
Dat_StartEndTime_t StartEndTime;
unsigned NumQstsInThisResult;
unsigned NumQstsNotBlankInThisResult;
@@ -436,11 +436,12 @@ static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
row = mysql_fetch_row (mysql_res);
/* Get match code (row[0]) */
- if ((MchCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
+ if ((Match.MchCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of match.");
+ Mch_GetDataOfMatchByCod (&Match);
/* Show match result? */
- ShowResultThisMatch = Mch_CheckIfICanSeeMatchResult (MchCod,UsrDat->UsrCod);
+ ShowResultThisMatch = Mch_CheckIfICanSeeMatchResult (Match.MchCod,UsrDat->UsrCod);
ShowSummaryResults = ShowSummaryResults && ShowResultThisMatch;
if (NumResult)
@@ -526,15 +527,17 @@ static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
Gbl.RowEvenOdd);
if (ShowResultThisMatch)
{
+ Gam_SetParamCurrentGamCod (Match.GamCod); // Used to pass parameter
+ Mch_SetParamCurrentMchCod (Match.MchCod); // Used to pass parameter
switch (MeOrOther)
{
case Usr_ME:
Frm_StartForm (ActSeeOneMchResMe);
- Mch_PutParamMchCod (MchCod);
+ Mch_PutParamsEdit ();
break;
case Usr_OTHER:
Frm_StartForm (ActSeeOneMchResOth);
- Mch_PutParamMchCod (MchCod);
+ Mch_PutParamsEdit ();
Usr_PutParamOtherUsrCodEncrypted ();
break;
}
@@ -645,6 +648,7 @@ void Mch_ShowOneMchResult (void)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Match_result;
+ extern const char *Txt_The_user_does_not_exist;
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_Today;
@@ -772,9 +776,9 @@ void Mch_ShowOneMchResult (void)
/***** Header row *****/
/* Get data of the user who answer the match */
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS))
- Lay_ShowErrorAndExit ("User does not exists.");
+ Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
if (!Usr_CheckIfICanViewTst (UsrDat))
- Lay_ShowErrorAndExit ("You can not view this match result.");
+ Act_NoPermissionExit ();
/* User */
fprintf (Gbl.F.Out," | "
@@ -876,7 +880,7 @@ void Mch_ShowOneMchResult (void)
Box_EndBox ();
}
else // I am not allowed to view this match result
- Lay_ShowErrorAndExit ("You can not view this match result.");
+ Act_NoPermissionExit ();
}
/*****************************************************************************/
@@ -1074,4 +1078,3 @@ static bool Mch_GetVisibilityMchResultFromDB (long MchCod)
return ShowUsrResults;
}
-
diff --git a/swad_survey.c b/swad_survey.c
index 5eb257dda..36eb5c0b2 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -1518,7 +1518,7 @@ void Svy_AskRemSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not remove this survey.");
+ Act_NoPermissionExit ();
/***** Show question and button to remove survey *****/
Svy_CurrentSvyCod = Svy.SvyCod;
@@ -1551,7 +1551,7 @@ void Svy_RemoveSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not remove this survey.");
+ Act_NoPermissionExit ();
/***** Remove all the users in this survey *****/
DB_QueryDELETE ("can not remove users who are answered a survey",
@@ -1615,7 +1615,7 @@ void Svy_AskResetSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not reset this survey.");
+ Act_NoPermissionExit ();
/***** Ask for confirmation of reset *****/
Ale_ShowAlert (Ale_WARNING,Txt_Do_you_really_want_to_reset_the_survey_X,
@@ -1663,7 +1663,7 @@ void Svy_ResetSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not reset this survey.");
+ Act_NoPermissionExit ();
/***** Remove all the users in this survey *****/
DB_QueryDELETE ("can not remove users who are answered a survey",
@@ -1709,7 +1709,7 @@ void Svy_HideSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not hide this survey.");
+ Act_NoPermissionExit ();
/***** Hide survey *****/
DB_QueryUPDATE ("can not hide survey",
@@ -1744,7 +1744,7 @@ void Svy_UnhideSurvey (void)
/***** Get data of the survey from database *****/
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not unhide this survey.");
+ Act_NoPermissionExit ();
/***** Show survey *****/
DB_QueryUPDATE ("can not show survey",
@@ -1808,7 +1808,7 @@ void Svy_RequestCreatOrEditSvy (void)
{
/***** Put link (form) to create new survey *****/
if (!Svy_CheckIfICanCreateSvy ())
- Lay_ShowErrorAndExit ("You can not create a new survey here.");
+ Act_NoPermissionExit ();
/* Initialize to empty survey */
Svy.SvyCod = -1L;
@@ -1833,7 +1833,7 @@ void Svy_RequestCreatOrEditSvy (void)
/* Get data of the survey from database */
Svy_GetDataOfSurveyByCod (&Svy);
if (!Svy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not update this survey.");
+ Act_NoPermissionExit ();
/* Get text of the survey from database */
Svy_GetSurveyTxtFromDB (Svy.SvyCod,Txt);
@@ -2108,7 +2108,7 @@ void Svy_RecFormSurvey (void)
OldSvy.SvyCod = NewSvy.SvyCod;
Svy_GetDataOfSurveyByCod (&OldSvy);
if (!OldSvy.Status.ICanEdit)
- Lay_ShowErrorAndExit ("You can not update this survey.");
+ Act_NoPermissionExit ();
NewSvy.Scope = OldSvy.Scope;
}
diff --git a/swad_test.c b/swad_test.c
index 993a9052f..b9c81db87 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -8018,6 +8018,7 @@ void Tst_ShowOneTstResult (void)
{
extern const char *Hlp_ASSESSMENT_Tests_results;
extern const char *Txt_Test_result;
+ extern const char *Txt_The_user_does_not_exist;
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Date;
extern const char *Txt_Today;
@@ -8109,9 +8110,9 @@ void Tst_ShowOneTstResult (void)
/***** Header row *****/
/* Get data of the user who made the test */
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
- Lay_ShowErrorAndExit ("User does not exists.");
+ Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
if (!Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat))
- Lay_ShowErrorAndExit ("You can not view this test result.");
+ Act_NoPermissionExit ();
/* User */
fprintf (Gbl.F.Out,"
"
@@ -8208,7 +8209,7 @@ void Tst_ShowOneTstResult (void)
Box_EndBox ();
}
else // I am not allowed to view this test result
- Lay_ShowErrorAndExit ("You can not view this test result.");
+ Act_NoPermissionExit ();
}
/*****************************************************************************/