From 86efca6412b355dd51c9b51c0cd407e82982001e Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 21 May 2020 16:59:14 +0200 Subject: [PATCH] Version19.239.9 --- swad_changelog.h | 3 ++- swad_exam_print.c | 2 +- swad_exam_session.c | 30 ++++++++++++++++++------------ swad_exam_session.h | 3 ++- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 944e9d56..5b903384 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -557,10 +557,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.239.8 (2020-05-21)" +#define Log_PLATFORM_VERSION "SWAD 19.239.9 (2020-05-21)" #define CSS_FILE "swad19.238.2.css" #define JS_FILE "swad19.239.6.js" /* + Version 19.239.9: May 21, 2020 Fixed issue in exam sessions: exam prints in sessions of hidden exams are no accesible. (301441 lines) Version 19.239.8: May 21, 2020 Fixed issue in exam sessions: a student can not see hidden sessions. (301433 lines) Version 19.239.7: May 21, 2020 Fixed bug in permissions to see exam results. Reported by Eduardo Ros Vidal. (301412 lines) Version 19.239.6: May 21, 2020 Code refactoring in JS function to escape chars. (301411 lines) diff --git a/swad_exam_print.c b/swad_exam_print.c index a1679c24..460557a6 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -185,7 +185,7 @@ void ExaPrn_ShowExamPrint (void) ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session); /***** Check if I can access to this session *****/ - if (ExaSes_CheckIfICanAnswerThisSession (&Session)) + if (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session)) { /***** Get print data from database *****/ Print.SesCod = Session.SesCod; diff --git a/swad_exam_session.c b/swad_exam_session.c index 872b8c49..cd95de07 100644 --- a/swad_exam_session.c +++ b/swad_exam_session.c @@ -91,6 +91,7 @@ static void ExaSes_ListOneOrMoreSessionsAuthor (const struct ExaSes_Session *Ses static void ExaSes_ListOneOrMoreSessionsTimes (const struct ExaSes_Session *Session, unsigned UniqueId); static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, + const struct Exa_Exam *Exam, const struct ExaSes_Session *Session, const char *Anchor); static void ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (const struct ExaSes_Session *Session); @@ -145,9 +146,9 @@ void ExaSes_ResetSession (struct ExaSes_Session *Session) /*****************************************************************************/ void ExaSes_ListSessions (struct Exa_Exams *Exams, - struct Exa_Exam *Exam, - struct ExaSes_Session *Session, - bool PutFormSession) + struct Exa_Exam *Exam, + struct ExaSes_Session *Session, + bool PutFormSession) { extern const char *Hlp_ASSESSMENT_Exams_sessions; extern const char *Txt_Sessions; @@ -440,7 +441,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, ExaSes_ListOneOrMoreSessionsTimes (&Session,UniqueId); /* Title and groups */ - ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,&Session,Anchor); + ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,Exam,&Session,Anchor); /* Session result visible? */ ExaSes_ListOneOrMoreSessionsResult (Exams,&Session); @@ -616,8 +617,9 @@ static void ExaSes_ListOneOrMoreSessionsTimes (const struct ExaSes_Session *Sess /*****************************************************************************/ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, - const struct ExaSes_Session *Session, - const char *Anchor) + const struct Exa_Exam *Exam, + const struct ExaSes_Session *Session, + const char *Anchor) { extern const char *Txt_Play; extern const char *Txt_Resume; @@ -626,7 +628,7 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, /***** Session title *****/ HTM_ARTICLE_Begin (Anchor); - if (ExaSes_CheckIfICanAnswerThisSession (Session)) + if (ExaSes_CheckIfICanAnswerThisSession (Exam,Session)) { Frm_StartForm (ActSeeExaPrn); Exa_PutParams (Exams); @@ -634,7 +636,7 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, HTM_BUTTON_SUBMIT_Begin (Gbl.Usrs.Me.Role.Logged == Rol_STD ? Txt_Play : Txt_Resume, Session->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT": - "BT_LINK LT ASG_TITLE", + "BT_LINK LT ASG_TITLE", NULL); HTM_Txt (Session->Title); HTM_BUTTON_End (); @@ -643,7 +645,7 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, else { HTM_SPAN_Begin ("class=\"%s\"",Session->Hidden ? "LT ASG_TITLE_LIGHT": - "LT ASG_TITLE"); + "LT ASG_TITLE"); HTM_Txt (Session->Title); HTM_SPAN_End (); } @@ -1653,12 +1655,16 @@ unsigned ExaSes_GetNumOpenSessionsInExam (long ExaCod) /******** Check if I belong to any of the groups of an exam session **********/ /*****************************************************************************/ -bool ExaSes_CheckIfICanAnswerThisSession (const struct ExaSes_Session *Session) +bool ExaSes_CheckIfICanAnswerThisSession (const struct Exa_Exam *Exam, + const struct ExaSes_Session *Session) { - /***** Hidden or closed sessions are not accesible *****/ - if (Session->Hidden || !Session->Open) + /***** 1. Sessions in hidden exams are not accesible + 2. Hidden or closed sessions are not accesible *****/ + if (Exam->Hidden || Session->Hidden || !Session->Open) return false; + /***** Exam is visible, session is visible and open ==> + ==> I can answer this session if I can list it based on groups *****/ return ExaSes_CheckIfICanListThisSessionBasedOnGrps (Session->SesCod); } diff --git a/swad_exam_session.h b/swad_exam_session.h index 9f86b0e6..86b90045 100644 --- a/swad_exam_session.h +++ b/swad_exam_session.h @@ -86,7 +86,8 @@ void ExaSes_RemoveGroupsOfType (long GrpTypCod); unsigned ExaSes_GetNumSessionsInExam (long ExaCod); unsigned ExaSes_GetNumOpenSessionsInExam (long ExaCod); -bool ExaSes_CheckIfICanAnswerThisSession (const struct ExaSes_Session *Session); +bool ExaSes_CheckIfICanAnswerThisSession (const struct Exa_Exam *Exam, + const struct ExaSes_Session *Session); bool ExaSes_CheckIfICanListThisSessionBasedOnGrps (long SesCod); #endif