Version19.130.2

This commit is contained in:
Antonio Cañas Vargas 2020-02-24 12:43:18 +01:00
parent 2520d5c852
commit 7225bbe670
12 changed files with 65 additions and 77 deletions

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.129 (2020-02-20)"
#define Log_PLATFORM_VERSION "SWAD 19.130.2 (2020-02-24)"
#define CSS_FILE "swad19.118.css"
#define JS_FILE "swad19.91.1.js"
/*
@ -522,9 +522,10 @@ Param
// TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario
// TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado)
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
// TODO: Análisis > Informe: "Informe de uso de SWAD" sale descentrado
// TODO: Fig_GetAndShowCourseProgramStats
Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines)
Version 19.130.1: Feb 24, 2020 Fixed bugs related to database. (281259 lines)
Version 19.130: Feb 20, 2020 New module swad_program. (281273 lines)
2 changes necessary in database:
CREATE TABLE IF NOT EXISTS prg_grp (PrgIteCod INT NOT NULL,GrpCod INT NOT NULL,UNIQUE INDEX(PrgIteCod,GrpCod));

View File

@ -711,7 +711,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
}
/***** Free structure that stores the query result *****/
mysql_free_result (mysql_res);
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
@ -761,7 +761,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role
}
/***** Free structure that stores the query result *****/
mysql_free_result (mysql_res);
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/

View File

@ -488,7 +488,6 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Rol_Role_t Role;
SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get user's role in course from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get user's role"
@ -2033,7 +2032,6 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Rol_Role_t DesiredRole;
SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get user and requested role from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get enrolment request",

View File

@ -11724,7 +11724,6 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat)
/*****************************************************************************/
/******************** Get summary and content of a file **********************/
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,

View File

@ -1447,7 +1447,6 @@ void Fol_GetAndShowRankingFollowers (void)
/*****************************************************************************/
/********************* Get notification of a new follower ********************/
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr)

View File

@ -1366,53 +1366,49 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
/*****************************************************************************/
/***************** Get summary and content for a forum post ******************/
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,
long PstCod,bool GetContent)
{
char *Query = NULL;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error
/***** Get subject of message from database *****/
if (asprintf (&Query,"SELECT Subject,Content FROM forum_post"
" WHERE PstCod=%ld",PstCod) < 0)
Lay_NotEnoughMemoryExit ();
if (!mysql_query (&Gbl.mysql,Query))
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
{
/***** Result should have a unique row *****/
if (mysql_num_rows (mysql_res) == 1)
{
/***** Get subject and content of the message *****/
row = mysql_fetch_row (mysql_res);
/***** Get post subject and content from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get subject and content",
"SELECT Subject," // row[0]
"Content" // row[1]
" FROM forum_post"
" WHERE PstCod=%ld",PstCod) == 1)
{
/***** Get subject and content of the post *****/
row = mysql_fetch_row (mysql_res);
/***** Copy subject *****/
Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY);
/***** Copy subject *****/
Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY);
/***** Copy content *****/
if (GetContent)
{
Length = strlen (row[1]);
/***** Copy content *****/
if (GetContent)
{
Length = strlen (row[1]);
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
if (Length)
Str_Copy (*ContentStr,row[1],
Length);
else
**ContentStr = '\0';
}
}
mysql_free_result (mysql_res);
}
if (Length)
Str_Copy (*ContentStr,row[1],
Length);
else
**ContentStr = '\0';
}
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/

View File

@ -348,5 +348,5 @@ void Log_GetAndShowLastClicks (void)
HTM_TABLE_End ();
/***** Free structure that stores the query result *****/
mysql_free_result (mysql_res);
DB_FreeMySQLResult (&mysql_res);
}

View File

@ -716,7 +716,6 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char *Ptr;
SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);

View File

@ -3099,7 +3099,6 @@ void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get subject of message from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get subject and content"

View File

@ -766,7 +766,6 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get subject of message from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get content of notice",

View File

@ -461,7 +461,7 @@ static void Rep_WriteHeader (const struct Rep_Report *Report)
fprintf (Gbl.F.Rep,"<h1>");
fprintf (Gbl.F.Rep,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
fprintf (Gbl.F.Rep,"</h1>");
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/***** User *****/
fprintf (Gbl.F.Rep,"<li>%s: <strong>%s</strong></li>",
@ -504,7 +504,7 @@ static void Rep_WriteSectionPlatform (void)
fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>",
Txt_Teaching_platform);
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/***** Platform name *****/
fprintf (Gbl.F.Rep,"<li>%s: %s, %s</li>",
@ -543,7 +543,7 @@ static void Rep_WriteSectionUsrInfo (void)
fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>",
Txt_Personal_information);
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/***** User's name *****/
fprintf (Gbl.F.Rep,"<li>%s: %s</li>",
@ -605,7 +605,7 @@ static void Rep_WriteSectionUsrFigures (const struct Rep_Report *Report)
fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>",
Txt_Figures);
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/***** Time since first click until now *****/
fprintf (Gbl.F.Rep,"<li>%s ",Txt_TIME_Since);
@ -865,7 +865,7 @@ static void Rep_WriteSectionCurrentCourses (struct Rep_Report *Report)
if (Report->CurrentTimeUTC.StrDate[0])
fprintf (Gbl.F.Rep," (%s)",Report->CurrentTimeUTC.StrDate);
fprintf (Gbl.F.Rep,"</h3>");
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/***** Number of courses in which the user is student/teacher *****/
for (Role = Rol_STD;
@ -896,7 +896,7 @@ static void Rep_WriteSectionHistoricCourses (struct Rep_Report *Report)
Txt_Courses,Txt_historical_log);
fprintf (Gbl.F.Rep,Txt_Only_courses_with_more_than_X_clicks_are_shown,
Rep_MIN_CLICKS_CRS);
HTM_UL_Begin (NULL);
fprintf (Gbl.F.Rep,"<ul>");
/********* Historic clicks of a user without course selected ***********/
Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report);

View File

@ -1452,13 +1452,11 @@ static void Svy_GetSurveyTxtFromDB (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]
/*****************************************************************************/
/******************** Get summary and content of a survey *******************/
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,
long SvyCod,bool GetContent)
{
char Query[128];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
size_t Length;
@ -1466,33 +1464,33 @@ void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
SummaryStr[0] = '\0'; // Return nothing on error
/***** Build query *****/
sprintf (Query,"SELECT Title,Txt FROM surveys WHERE SvyCod=%ld",
SvyCod);
if (!mysql_query (&Gbl.mysql,Query))
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
{
/***** Result should have a unique row *****/
if (mysql_num_rows (mysql_res) == 1)
{
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
if (DB_QuerySELECT (&mysql_res,"can not get groups of a survey",
"SELECT Title," // row[0]
"Txt" // row[1]
" FROM surveys"
" WHERE SvyCod=%ld",
SvyCod) == 1)
{
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get summary *****/
Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY);
/***** Get summary *****/
Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY);
/***** Get content *****/
if (GetContent)
{
Length = strlen (row[1]);
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
Str_Copy (*ContentStr,row[1],
Length);
}
}
mysql_free_result (mysql_res);
}
/***** Get content *****/
if (GetContent)
{
Length = strlen (row[1]);
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
Str_Copy (*ContentStr,row[1],
Length);
}
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/