From 9343280967709bc0de42507adb278e44c645177c Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 23 Apr 2021 22:57:57 +0200 Subject: [PATCH] Version 20.66.5: Apr 23, 2021 Including missing head files. --- swad_changelog.h | 5 +++- swad_exam.c | 1 + swad_exam_result.c | 1 + swad_exam_session.c | 1 + swad_exam_set.c | 1 + swad_game.c | 1 + swad_indicator.c | 8 +++--- swad_match.c | 1 + swad_match_result.c | 1 + swad_notice.c | 1 + swad_pagination.c | 56 ++++++++++++++++++++--------------------- swad_timeline_comment.c | 1 + swad_timeline_form.c | 1 + swad_user.c | 21 ++++++++-------- 14 files changed, 57 insertions(+), 43 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 271775556..646f7cef1 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -600,13 +600,16 @@ TODO: Salvador Romero Cort TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. */ -#define Log_PLATFORM_VERSION "SWAD 20.66.3 (2021-04-23)" +#define Log_PLATFORM_VERSION "SWAD 20.66.5 (2021-04-23)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.66.5: Apr 23, 2021 Including missing head files. + Fixed bug getting my courses. (309123 lines) + Version 20.66.4: Apr 23, 2021 Fixed bug in pagination of messages. (309110 lines) Version 20.66.3: Apr 23, 2021 Fixed bug in course information. (309108 lines) Version 20.66.2: Apr 22, 2021 Clicks-without-photo database table renamed. (309126 lines) 1 change necessary in database: diff --git a/swad_exam.c b/swad_exam.c index 734107870..0017d7f97 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -31,6 +31,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_exam_result.c b/swad_exam_result.c index 0c40648b8..ff9bda678 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -29,6 +29,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_action.h" diff --git a/swad_exam_session.c b/swad_exam_session.c index 51e147377..5a3f6ab8c 100644 --- a/swad_exam_session.c +++ b/swad_exam_session.c @@ -29,6 +29,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_exam_set.c b/swad_exam_set.c index 6865f170f..cbc5f6bee 100644 --- a/swad_exam_set.c +++ b/swad_exam_set.c @@ -31,6 +31,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_game.c b/swad_game.c index e3db5b94e..5511c7974 100644 --- a/swad_game.c +++ b/swad_game.c @@ -30,6 +30,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_indicator.c b/swad_indicator.c index 37c6b729f..7baff7299 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -1191,21 +1191,21 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I HTM_TD_Begin ("class=\"%s LM COLOR%u\"", (IndicatorsCrs.SyllabusLecSrc != Inf_NONE) ? "DAT_SMALL_GREEN" : - "DAT_SMALL_RED", + "DAT_SMALL_RED", Gbl.RowEvenOdd); HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[IndicatorsCrs.SyllabusLecSrc]); HTM_TD_End (); HTM_TD_Begin ("class=\"%s LM COLOR%u\"", (IndicatorsCrs.SyllabusPraSrc != Inf_NONE) ? "DAT_SMALL_GREEN" : - "DAT_SMALL_RED", + "DAT_SMALL_RED", Gbl.RowEvenOdd); HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[IndicatorsCrs.SyllabusPraSrc]); HTM_TD_End (); - HTM_TD_Begin ("class=\"%s LM COLOR%u\">", + HTM_TD_Begin ("class=\"%s LM COLOR%u\"", (IndicatorsCrs.TeachingGuideSrc != Inf_NONE) ? "DAT_SMALL_GREEN" : - "DAT_SMALL_RED", + "DAT_SMALL_RED", Gbl.RowEvenOdd); HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[IndicatorsCrs.TeachingGuideSrc]); HTM_TD_End (); diff --git a/swad_match.c b/swad_match.c index 44f76242f..91bcaa6e2 100644 --- a/swad_match.c +++ b/swad_match.c @@ -29,6 +29,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_match_result.c b/swad_match_result.c index b038727a3..88216060f 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -29,6 +29,7 @@ #include // For PATH_MAX #include // For NULL #include // For asprintf +#include // For free #include // For string functions #include "swad_action.h" diff --git a/swad_notice.c b/swad_notice.c index 7364eb3dc..547a34694 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -29,6 +29,7 @@ #include // For PATH_MAX #include // For NULL #include // For sscanf, asprintf, etc. +#include // For free #include #include "swad_box.h" diff --git a/swad_pagination.c b/swad_pagination.c index 028dfb85b..4869d1dcb 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -903,19 +903,16 @@ unsigned Pag_GetParamPagNum (Pag_WhatPaginate_t WhatPaginate) /* Expanding a message, perhaps it is the result of following a link from a notification of received message */ /* Show the page corresponding to the expanded message */ - CurrentPage = 1; // Now set the current page to the first, + return 1; // Now set the current page to the first, // but later the correct page will be calculated - else - /* Show the last visited page */ - CurrentPage = Pag_GetLastPageMsgFromSession (Pag_MESSAGES_RECEIVED); - break; + + /* Show the last visited page */ + return Pag_GetLastPageMsgFromSession (Pag_MESSAGES_RECEIVED); case Pag_MESSAGES_SENT: /* Show the last visited page */ - CurrentPage = Pag_GetLastPageMsgFromSession (Pag_MESSAGES_SENT); - break; + return Pag_GetLastPageMsgFromSession (Pag_MESSAGES_SENT); default: - CurrentPage = 1; - break; + return 1; } return CurrentPage; @@ -943,25 +940,28 @@ void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned Nu unsigned Pag_GetLastPageMsgFromSession (Pag_WhatPaginate_t WhatPaginate) { - MYSQL_RES *mysql_res; - MYSQL_ROW row; + static const char *Field[Pag_NUM_WHAT_PAGINATE] = + { + [Pag_MESSAGES_RECEIVED] = "LastPageMsgRcv", + [Pag_MESSAGES_SENT ] = "LastPageMsgSnt", + }; unsigned NumPage; - /***** Get last page of received/sent messages from database *****/ - if (DB_QuerySELECT (&mysql_res,"can not get last page of messages", - "SELECT %s" // row[0] - " FROM ses_sessions" - " WHERE SessionId='%s'", - WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" : - "LastPageMsgSnt", - Gbl.Session.Id)) - Lay_ShowErrorAndExit ("Error when getting last page of messages."); - - /***** Get last page of messages *****/ - row = mysql_fetch_row (mysql_res); - if (sscanf (row[0],"%u",&NumPage) == 1) - if (NumPage == 0) - NumPage = 1; - - return NumPage; + switch (WhatPaginate) + { + case Pag_MESSAGES_RECEIVED: + case Pag_MESSAGES_SENT: + /***** Get last page of received/sent messages from database *****/ + NumPage = DB_QuerySELECTUnsigned ("can not get last page of messages", + "SELECT %s" + " FROM ses_sessions" + " WHERE SessionId='%s'", + Field[WhatPaginate], + Gbl.Session.Id); + if (NumPage == 0) + return 1; + return NumPage; + default: + return 1; + } } diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 0e7c216b5..ee64ada5a 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -28,6 +28,7 @@ #define _GNU_SOURCE // For asprintf #include // For PATH_MAX #include // For asprintf +#include // For free #include "swad_forum.h" #include "swad_global.h" diff --git a/swad_timeline_form.c b/swad_timeline_form.c index 9d87d0010..3a2b661a5 100644 --- a/swad_timeline_form.c +++ b/swad_timeline_form.c @@ -28,6 +28,7 @@ #define _GNU_SOURCE // For asprintf #include // For asprintf +#include // For free #include "swad_action.h" #include "swad_global.h" diff --git a/swad_user.c b/swad_user.c index 695bf0439..bf76094a1 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1730,8 +1730,8 @@ void Usr_GetMyCourses (void) { MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned NumCrs; unsigned NumCrss; + unsigned NumCrs; long CrsCod; /***** If my courses are yet filled, there's nothing to do *****/ @@ -1746,11 +1746,11 @@ void Usr_GetMyCourses (void) /***** Create temporary table with my courses *****/ DB_Query ("can not create temporary table", - "CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp " - "(CrsCod INT NOT NULL," - "Role TINYINT NOT NULL," - "DegCod INT NOT NULL," - "UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY" + "CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp" + " (CrsCod INT NOT NULL," + "Role TINYINT NOT NULL," + "DegCod INT NOT NULL," + "UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY" " SELECT crs_users.CrsCod," "crs_users.Role," "crs_courses.DegCod" @@ -1779,7 +1779,8 @@ void Usr_GetMyCourses (void) row = mysql_fetch_row (mysql_res); /* Get course code */ - if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0) + CrsCod = Str_ConvertStrCodToLongCod (row[0]); + if (CrsCod > 0) { if (Gbl.Usrs.Me.MyCrss.Num == Crs_MAX_COURSES_PER_USR) Lay_ShowErrorAndExit ("Maximum number of courses of a user exceeded."); @@ -1793,10 +1794,10 @@ void Usr_GetMyCourses (void) /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - } - /***** Set boolean that indicates that my courses are yet filled *****/ - Gbl.Usrs.Me.MyCrss.Filled = true; + /***** Set boolean that indicates that my courses are already filled *****/ + Gbl.Usrs.Me.MyCrss.Filled = true; + } } }