diff --git a/swad_changelog.h b/swad_changelog.h index 3a753e586..d654a1185 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -557,13 +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.235.2 (2020-05-17)" +#define Log_PLATFORM_VERSION "SWAD 19.235.3 (2020-05-17)" #define CSS_FILE "swad19.230.1.css" #define JS_FILE "swad19.230.3.js" /* -TODO: Comprobar si el directorio público que devuelve Ses_GetPublicDirFromCache sigue existiendo. -// Si no existe, hay que crear un nuevo directorio y meterlo en cache - + Version 19.235.3: May 17, 2020 Check if temporary public directory exists when got from cache. (301239 lines) Version 19.235.2: May 17, 2020 Changes in exam prints. (301216 lines) Version 19.235.1: May 17, 2020 Changes in edition of bank of questions. (301193 lines) Version 19.235: May 17, 2020 New module swad_tag for question tags. (301147 lines) diff --git a/swad_database.c b/swad_database.c index 931b7e42f..2ad9f2b2c 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1365,9 +1365,9 @@ mysql> DESCRIBE file_cache; */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_cache (" "SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID - "PrivPath TEXT COLLATE latin1_bin NOT NULL," // PATH_MAX - "TmpPubDir TEXT COLLATE latin1_bin NOT NULL," // PATH_MAX - "INDEX(SessionId))"); + "PrivPath VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX + "TmpPubDir VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX + "UNIQUE INDEX(SessionId))"); /***** Table file_view *****/ /* diff --git a/swad_exam.c b/swad_exam.c index a796fe68a..11a9a0d44 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -244,7 +244,7 @@ static void Exa_ListAllExams (struct Exa_Exams *Exams) if (Exams->Num) { /***** Table head *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); if (Exa_CheckIfICanEditExams ()) HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons diff --git a/swad_exam_result.c b/swad_exam_result.c index d3b7c5777..4267529ee 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -1176,7 +1176,7 @@ void ExaRes_ShowOneExaResult (void) Gbl.Hierarchy.Crs.CrsCod); /***** Begin table *****/ - HTM_TABLE_BeginWideMarginPadding (5); + HTM_TABLE_BeginWideMarginPadding (10); /***** Header row *****/ /* Get data of the user who answer the session */ diff --git a/swad_exam_set.c b/swad_exam_set.c index cd8c5b8ce..4c6b0a5cc 100644 --- a/swad_exam_set.c +++ b/swad_exam_set.c @@ -1054,7 +1054,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, return; /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); ExaSet_PutTableHeadingForSets (); /***** Write rows *****/ @@ -1270,7 +1270,6 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams, { extern const char *Txt_Questions; extern const char *Txt_No_INDEX; - extern const char *Txt_Code; extern const char *Txt_Question; unsigned NumQst; MYSQL_ROW row; @@ -1281,13 +1280,12 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams, Frm_SetAnchorStr (Exams->SetCod,&Anchor); /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); HTM_TH_Empty (1); HTM_TH (1,1,"CT",Txt_No_INDEX); - HTM_TH (1,1,"CT",Txt_Code); HTM_TH (1,1,"CT",Txt_Question); HTM_TR_End (); @@ -1548,11 +1546,6 @@ static void ExaSet_ListQuestionForEdition (const struct Tst_Question *Question, Tst_WriteAnswerType (Question->Answer.Type); HTM_TD_End (); - /***** Write question code *****/ - HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd); - HTM_TxtF ("%ld ",Question->QstCod); - HTM_TD_End (); - /***** Write stem (row[3]) and media *****/ HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd); HTM_ARTICLE_Begin (Anchor); diff --git a/swad_game.c b/swad_game.c index a29dd0126..d26532bec 100644 --- a/swad_game.c +++ b/swad_game.c @@ -273,7 +273,7 @@ static void Gam_ListAllGames (struct Gam_Games *Games) if (Games->Num) { /***** Table head *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); if (Gam_CheckIfICanEditGames ()) HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons @@ -2005,7 +2005,7 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, MaxQstInd = Gam_GetMaxQuestionIndexInGame (GamCod); // 0 is no questions in game /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); HTM_TH_Empty (1); diff --git a/swad_match_result.c b/swad_match_result.c index f61cfc65d..2515677df 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -1157,7 +1157,7 @@ void MchRes_ShowOneMchResult (void) Gbl.Hierarchy.Crs.CrsCod); /***** Begin table *****/ - HTM_TABLE_BeginWideMarginPadding (5); + HTM_TABLE_BeginWideMarginPadding (10); /***** Header row *****/ /* Get data of the user who answer the match */ diff --git a/swad_session.c b/swad_session.c index 42fa3b74a..89d31cc32 100644 --- a/swad_session.c +++ b/swad_session.c @@ -55,6 +55,8 @@ static void Ses_RemoveSessionFromDB (void); static bool Ses_CheckIfHiddenParIsAlreadyInDB (const char *ParamName); +static void Ses_DeletePublicDirFromCache (const char *FullPathMediaPriv); + /*****************************************************************************/ /************************** Get number of open sessions **********************/ /*****************************************************************************/ @@ -465,7 +467,8 @@ bool Ses_GetPublicDirFromCache (const char *FullPathMediaPriv, { MYSQL_RES *mysql_res; MYSQL_ROW row; - bool Cached = false; + bool Cached; + bool TmpPubDirExists; /***** Reset temporary directory *****/ TmpPubDir[0] = '\0'; @@ -481,14 +484,40 @@ bool Ses_GetPublicDirFromCache (const char *FullPathMediaPriv, /* Get the temporary public directory (row[0]) */ row = mysql_fetch_row (mysql_res); Str_Copy (TmpPubDir,row[0],PATH_MAX); - Cached = true; } + else + Cached = false; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); + + /***** Check if temporary public directory exists *****/ + if (Cached) + { + /* If not exists (it could be deleted if its lifetime has expired) + ==> remove from cache */ + TmpPubDirExists = Fil_CheckIfPathExists (TmpPubDir); + if (!TmpPubDirExists) + Ses_DeletePublicDirFromCache (FullPathMediaPriv); + return TmpPubDirExists; + } } - return Cached; + return false; + } + +/*****************************************************************************/ +/********* Add public directory used to link private path to cache ***********/ +/*****************************************************************************/ + +static void Ses_DeletePublicDirFromCache (const char *FullPathMediaPriv) + { + /***** Delete possible entry *****/ + if (Gbl.Session.IsOpen) + DB_QueryDELETE ("can not remove cached file", + "DELETE FROM file_cache" + " WHERE SessionId='%s' AND PrivPath='%s'", + Gbl.Session.Id,FullPathMediaPriv); } /*****************************************************************************/ @@ -500,12 +529,18 @@ void Ses_AddPublicDirToCache (const char *FullPathMediaPriv, { /***** Insert into cache *****/ if (Gbl.Session.IsOpen) + { + /* Delete possible old entry */ + Ses_DeletePublicDirFromCache (FullPathMediaPriv); + + /* Insert new entry */ DB_QueryINSERT ("can not cache file", "INSERT INTO file_cache" " (SessionId,PrivPath,TmpPubDir)" " VALUES" " ('%s','%s','%s')", Gbl.Session.Id,FullPathMediaPriv,TmpPubDir); + } } /*****************************************************************************/ diff --git a/swad_survey.c b/swad_survey.c index 1f4396de0..189dbfc98 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -262,7 +262,7 @@ static void Svy_ListAllSurveys (struct Svy_Surveys *Surveys) if (Surveys->Num) { /***** Table head *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons @@ -3289,7 +3289,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys, } /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); if (Svy->Status.ICanEdit) diff --git a/swad_test.c b/swad_test.c index 34a6378a0..bbaa26a35 100644 --- a/swad_test.c +++ b/swad_test.c @@ -2314,7 +2314,7 @@ static void Tst_ListOneQstToEdit (struct Tst_Test *Test) Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE); /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); Tst_WriteHeadingRowQuestionsForEdition (Test); /***** Write question row *****/ @@ -2348,7 +2348,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test, Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE); /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); Tst_WriteHeadingRowQuestionsForEdition (Test); /***** Write rows *****/ @@ -2607,7 +2607,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam ExaSet_PutParamsOneSet (Exams); /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); HTM_TH_Empty (1); @@ -2689,7 +2689,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam Gam_PutParams (Games); /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); HTM_TH_Empty (1); diff --git a/swad_test_import.c b/swad_test_import.c index cc7f977a5..6c36d048c 100644 --- a/swad_test_import.c +++ b/swad_test_import.c @@ -532,7 +532,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer) /* Current element is */ /***** Write heading of list of imported questions *****/ - HTM_TABLE_BeginWideMarginPadding (2); + HTM_TABLE_BeginWideMarginPadding (5); TsI_WriteHeadingListImportedQst (); /***** For each question... *****/ diff --git a/swad_test_print.c b/swad_test_print.c index 30a545d20..290b28785 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -1961,7 +1961,7 @@ void TstPrn_ShowOneExam (void) Gbl.Hierarchy.Crs.CrsCod); /***** Begin table *****/ - HTM_TABLE_BeginWideMarginPadding (5); + HTM_TABLE_BeginWideMarginPadding (10); /***** Header row *****/ /* Get data of the user who made the test */