Version19.235.3

This commit is contained in:
acanas 2020-05-17 22:16:39 +02:00
parent 7c87e9f456
commit 8205714b98
12 changed files with 58 additions and 32 deletions

View File

@ -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)

View File

@ -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 *****/
/*

View File

@ -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

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);
}
}
/*****************************************************************************/

View File

@ -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)

View File

@ -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);

View File

@ -532,7 +532,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
/* Current element is <test> */
/***** Write heading of list of imported questions *****/
HTM_TABLE_BeginWideMarginPadding (2);
HTM_TABLE_BeginWideMarginPadding (5);
TsI_WriteHeadingListImportedQst ();
/***** For each question... *****/

View File

@ -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 */